mousemove.js
来自「这是《JavaScript学习源代码》一书的源代码」· JavaScript 代码 · 共 25 行
JS
25 行
window.onerror=wassup;
function wassup(a,b,c){alert(a,b,c);}
// specify a MOUSEMOVE event-handler
window.document.onmousemove=showcoords;
// a function to react to the MOUSEMOVE event
function showcoords(e)
{
var xpos, ypos;
if(navigator.appName == "Microsoft Internet Explorer")
{
xpos = event.x; ypos = event.y;
}
else
{
xpos = e.pageX; ypos = e.pageY;
}
document.getElementById("txt").value = "X: " +xpos+ " Y: " +ypos ;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?