clientX Property Internet Development Index --------------------------------------------------------------------------------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.Syntaxevent.clientX [ = iXPos ] Possible ValuesiXPos Integer that specifies or receives the x-coordinate, in pixels. The property is read/write. The property has no default value.Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see About Dynamic Properties.ResThe property is read-only in Microsoft® Internet Explorer 4.0, and read/write in Internet Explorer 5 and later.Because the clientX property returns a value relative to the client, you can add the value of the scrollLeft property to determine the distance of the x-coordinate from the edge of the body element. Within a viewlink, the client area begins at the edge of the master element. ExampleThis example uses the clientX property to determine the mouse position relative to the window. The status window shows the mouse position at all times.HideExample<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); } </SCRIPT> </HEAD> <BODY onmousemove="window.status = 'X=' + window.event.clientX + ' Y=' + window.event.clientY" ondblclick="clientCoords()"> Show Me Standards InformationThere is no public standard that applies to this property. Applies To
x Property Internet Development Index --------------------------------------------------------------------------------Sets or retrieves the x-coordinate, in pixels, of the mouse pointer's position relative to a relatively positioned parent element.Syntaxevent.x [ = iX ] Possible ValuesiX Integer that specifies or receives the x-coordinate, in pixels. The property is read/write. The property has no default value.Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see About Dynamic Properties.ResThe property is read-only in Microsoft® Internet Explorer 4.0, and read/write in Internet Explorer 5 and later.In browser versions earlier than Internet Explorer 5, the x property retrieves a coordinate relative to the client.This property returns the x-coordinate of the closest relatively positioned parent element of the element that fires the event. If the event firing element is relatively positioned, then the x-coordinate from the boundary of the element is returned. If the event firing element and all of its parent elements are not relatively positioned, then the x property returns a coordinate relative to the body element.If the mouse is outside the window when the event is called, this property returns -1.ExampleThis example displays the current mouse position in the browser's status window.<BODY onmousemove="window.status = 'X=' + window.event.x + ' Y=' + window.event.y"> Standards InformationThere is no public standard that applies to this property.
对于坐标相关的属性,也不多吧,就那么十几个。查看手册的时候,注意查看的方法还是比较重要的。
这个搞定了,再看看event.
Possible ValuesiXPos Integer that specifies or receives the x-coordinate, in pixels. The property is read/write. The property has no default value.Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see About Dynamic Properties.ResThe property is read-only in Microsoft® Internet Explorer 4.0, and read/write in Internet Explorer 5 and later.Because the clientX property returns a value relative to the client, you can add the value of the scrollLeft property to determine the distance of the x-coordinate from the edge of the body element. Within a viewlink, the client area begins at the edge of the master element. ExampleThis example uses the clientX property to determine the mouse position relative to the window. The status window shows the mouse position at all times.HideExample<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);
}
</SCRIPT>
</HEAD>
<BODY onmousemove="window.status = 'X=' + window.event.clientX +
' Y=' + window.event.clientY"
ondblclick="clientCoords()">
Show Me
Standards InformationThere is no public standard that applies to this property. Applies To
Possible ValuesiX Integer that specifies or receives the x-coordinate, in pixels. The property is read/write. The property has no default value.Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see About Dynamic Properties.ResThe property is read-only in Microsoft® Internet Explorer 4.0, and read/write in Internet Explorer 5 and later.In browser versions earlier than Internet Explorer 5, the x property retrieves a coordinate relative to the client.This property returns the x-coordinate of the closest relatively positioned parent element of the element that fires the event. If the event firing element is relatively positioned, then the x-coordinate from the boundary of the element is returned. If the event firing element and all of its parent elements are not relatively positioned, then the x property returns a coordinate relative to the body element.If the mouse is outside the window when the event is called, this property returns -1.ExampleThis example displays the current mouse position in the browser's status window.<BODY onmousemove="window.status = 'X=' + window.event.x +
' Y=' + window.event.y">
Standards InformationThere is no public standard that applies to this property.
我找到答案了。这个文章讲的很详细,他内含一个程序,对于测试很有好处.
我际修改了一点可以动态获取各种属性,谁要可以给我留言
谢谢大家了。