顯示鼠標(biāo)坐標(biāo)
作者:晉城網(wǎng)站建設(shè) 日期:2010-02-15
本頁(yè)面已加入演示
腳本說(shuō)明:
第一步:把如下代碼加入<body>區(qū)域中:
<SCRIPT LANGUAGE="JavaScript">
if (navigator.appName == 'Netscape')
{
document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = netscapeMouseMove;
}
function netscapeMouseMove(e) {
if (e.screenX != document.test.x.value && e.screenY != document.test.y.value)
{
document.test.x.value = e.screenX;
document.test.y.value = e.screenY;
}
}
function micro$oftMouseMove() {
if (window.event.x != document.test.x.value && window.event.y != document.test.y.value)
{
document.test.x.value = window.event.x;
document.test.y.value = window.event.y;
}
}
</SCRIPT>
<FORM NAME="test">
X: <INPUT TYPE="TEXT" NAME="x" SIZE="4"> Y: <INPUT
TYPUE="TEXT" NAME="y" SIZE="4">
</FORM>
第二步:把<body>中內(nèi)容改為:
<body bgcolor="#fef4d9" onMousemove="micro$oftMouseMove()">