JavaScript得到鼠标坐标
代码如下: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>JavaScript得到鼠标坐标</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <meta name="Generator" content="EditPlus" /> <meta name="Author" content="Dicky"> <meta name="Keywords" content="Name:Dicky;QQ:25941;MSN:HaiJunGu@HotMail.Com"> <meta name="Description" content="Name:Dicky;QQ:25941;MSN:HaiJunGu@HotMail.Com"> <script language="javascript" type="text/javascript"> <!-- function document.onmousemove() { x.innerHTML = "相对位置:X:" + window.event.x + " Y:" + window.event.y; y.innerHTML = "绝对位置:X:" + window.event.screenX + " Y:" + window.event.screenY; } //--> </script> </head> <body> <div id="x"></div> <div id="y"></div> </body> </html>
[Ctrl+A 全选 提示:你可先修改部分代码,再点运行代码]
VbScript得到鼠标坐标
代码如下: <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>VbScript得到鼠标坐标</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <meta name="Generator" content="EditPlus" /> <meta name="Author" content="Dicky"> <meta name="Keywords" content="Name:Dicky;QQ:25941;MSN:HaiJunGu@HotMail.Com"> <meta name="Description" content="Name:Dicky;QQ:25941;MSN:HaiJunGu@HotMail.Com"> <script language="vbscript" type="text/vbscript"> <!-- Function GetMousePos() x.innerHTML = "相对位置:X:" & window.event.x & " Y:" & window.event.y y.innerHTML = "绝对位置:X:" & window.event.screenX & " Y:" & window.event.screenY End Function //--> </script> </head> <body οnmοusemοve="vbscript:GetMousePos()"> <div id="x"></div> <div id="y"></div> </body> </html>
[Ctrl+A 全选 提示:你可先修改部分代码,再点运行代码]