Writing /volume1/Web/Public/dokuwiki/data/log/deprecated/2024-11-15.log failed
文書の過去の版を表示しています。
Writing /volume1/Web/Public/dokuwiki/data/log/deprecated/2024-11-15.log failed
Mouse Cursor Position
document.compatMode
- Quirks mode[BACKCompat] : Standard-compliant mode is not switched on.
- Strict mode[CSS1Compat] : Standard-compliant mode is switched on.
function getPosition(e) { e = e || window.event; var cursor = {x:0, y:0}; if (e.pageX || e.pageY) { cursor.x = e.pageX; cursor.y = e.pageY; } else { var de = document.documentElement; var b = document.body; cursor.x = e.clientX + (de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0); cursor.y = e.clientY + (de.scrollTop || b.scrollTop) - (de.clientTop || 0); } return cursor; }
Test Sample
<html> <head> <script type=“text/javascript”> function open_win() { window.open(“./test/js/test_mouse_event_x_y.html”,“_blank”,“toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, copyhistory=yes, width=400, height=400”); } </script> </head>
<body> <a href=“#” onclick=“open_win()” style=“text-decoration:underline;color:#900B09”>What are the coordinates of the cursor?</a>
</body>
</html>