<html><body onmousemove="f()">
<INPUT id=aa>
<Script>
function f(){
aa.value="x:"+window.event.x+" y:"+window.event.y;
}
</Script>
</body></html>

解决方案 »

  1.   

    谢谢楼上的,你是把坐标值显示在了 INPUT 里面,我希望坐标值跟在鼠标边上
      

  2.   

    放个div不行吗?
    <html>
    <head>
    <META http-equiv="Content-Type" content="text/html; charset=gb2312">
    <script>
    function document.onmousemove(){
    var el=document.getElementById("showPos");
    el.style.left=event.clientX+10;
    el.style.top=event.clientY;
    el.innerHTML="X:"+event.clientX+"<br>Y:"+event.clientY;}
    </script>
    <div id='showPos' border=1 style='POSITION:absolute'>
    </div>
    </head>
    <body></body>
    </html>
      

  3.   

    <html>
    <head>
    <META http-equiv="Content-Type" content="text/html; charset=gb2312">
    <script>
    function document.onmousemove(){
    var el=document.getElementById("showPos");
    el.style.left=event.clientX+10;
    el.style.top=event.clientY+document.body.scrollTop;//////<====改成这样
    el.innerHTML="X:"+event.clientX+"<br>Y:"+event.clientY;}
    </script>
    <div id='showPos' border=1 style='POSITION:absolute'>
    </div>
    </head>
    <body></body>
    </html>