MouseEvent offsetY 属性
实例
Click inside a DIV and output the y-coordinate of the click, relative to the DIV element:
var x = event.offsetY;
亲自试一试 »
页面下方有更多实例。
定义和用法
offsetY
property returns the y-coordinate
of the mouse pointer, relative to the target element.
提示: To get the x-coordinate, use the offsetX property.
注释: 该属性是只读的。
浏览器支持
属性 | |||||
---|---|---|---|---|---|
offsetY | Yes | 6 | 39 | Yes | Yes |
语法
event.offsetY
技术细节
返回值: | A Number, representing the vertical coordinate of the mouse pointer, in pixels |
---|
相关页面
MouseEvent: offsetX Property
MouseEvent: clientX Property
MouseEvent: clientY Property
MouseEvent: screenX Property
MouseEvent: screenY Property