clientX Property Sets or retrieves the x-coordinate of the mouse pointer's position relative to the client area of the window, excluding window decorations and scroll bars.可发现 IE6sp1 下该属性仍为只读?!read-only!<!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> new document </title>
    <meta name="generator" content="editplus" />
    <meta name="author" content="Gao YiXiang" />
    <meta name="email" content="[email protected]" />
    <meta name="keywords" content="javascript dhtml dom" />
    <meta name="description" content="I love web development." />
<script>
function clientCoords()
{
var offsetInfo = ""
clientInfo = "The x coordinate is: " + window.event.clientX + "\r";
clientInfo += "The y coordinate is: " + window.event.clientY + "\r";
alert(clientInfo);
// 设置指针位置,但报错了!
window.event.clientX = 100;
window.event.clientY = 100;
}
</script>
</head>
<body onmousemove="window.status = 'X=' + window.event.clientX +
' Y=' + window.event.clientY"
ondblclick="clientCoords()">
    <div style="width: 200px; height: 200px; background-color: blue;"></div>
</body>
</html>
送你三本手册!DHTML参考手册
http://download.csdn.net/source/308913样式表中文手册
http://download.csdn.net/source/304124JScript语言参考
http://download.csdn.net/source/308916

解决方案 »

  1.   

    那只是一个使用示例,俺已经说了 window.event.clientX 无法设置,即 read-only,
    尽管手册上说可以 set,但是实验失败!<!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> new document </title>
        <meta name="generator" content="editplus" />
        <meta name="author" content="Gao YiXiang" />
        <meta name="email" content="[email protected]" />
        <meta name="keywords" content="javascript dhtml dom" />
        <meta name="description" content="I love web development." />
    </head>
    <!-- Error: 找不到成员! -->
    <body onmouseover="alert(window.event.clientX+' : '+window.event.clientY);window.event.clientX=100; window.event.clientY=100;">
        <div style="width: 200px; height: 200px; background-color: blue;"></div>
    </body>
    </html>