<html>
<head>
<title>IE与NS都支持的实时读取鼠标位置的例子</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta content="F.R.Huang(meizz梅花雨)//www.meizz.com" name="author">
</head>
<body bgcolor="#fef4d9" onmousemove="microsoftMouseMove()">
<form name="form1">
X: <input type="text" name="x" size="4"><br>
Y: <input type="text" name="y" size="4">
</form>
<SCRIPT LANGUAGE="JavaScript">
if (navigator.appname == 'Netscape')
{
document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = netscapeMouseMove;
}
function netscapeMouseMove(e)
{
if (e.screenX != document.form1.x.value && e.screenY != document.form1.y.value)
{
document.form1.x.value = e.screenX;
document.form1.y.value = e.screenY;
}
}
function microsoftMouseMove()
{
if (window.event.x != document.form1.x.value && window.event.y != document.form1.y.value)
{
document.form1.x.value = window.event.x;
document.form1.y.value = window.event.y;
}
}
</SCRIPT>
</body></html>