<script type="text/javascript"> document.onmousemove = function(e) { // InternetExplorer 用 if (!e) e= window.event; target = document.getElementById('sampleform'); target.xpos.value= e.clientX; target.ypos.value= e.clientY; } </script> </head> <body> <h1>Mouse Move</h1> <h3>マウスの座標を表示</h3> <form action="" method="" id="sampleform"> <ul> <li>X-POS: <input type="text" value="" name="xpos" /></li> <li>Y-POS: <input type="text" value="" name="ypos" /></li> </ul> </form> |
<form action="" method="" id="sampleform"> <ul> <li>X-POS: <input type="text" value="" name="xpos" /></li> <li>Y-POS: <input type="text" value="" name="ypos" /></li> </ul> </form> |
document.onmousemove = function(e) { // InternetExplorer 用 if (!e) e= window.event; target = document.getElementById('sampleform'); target.xpos.value= e.clientX; target.ypos.value= e.clientY; } </script> |