當(dāng)事件被觸發(fā)時(shí),screenY鼠標(biāo)事件返回鼠標(biāo)指針的垂直坐標(biāo)。
示例
您可以嘗試運(yùn)行以下代碼可了解如何在 JavaScript 中實(shí)現(xiàn) screenY 鼠標(biāo)事件。
<!DOCTYPE html>
<html>
<body>
<p onclick = "coordsFunc(event)">Click here to get the x (horizontal) and y (vertical) coordinates of the mouse pointer.</p>
<script>
function coordsFunc(event) {
var x_coord = event.screenX;
var y_coord = event.screenY;
var xycoords = "X coords= " + x_coord + ", Y coords= " + y_coord;
document.write(xycoords);
}
</script>
</body>
</html>
登錄后復(fù)制
以上就是屏幕Y鼠標(biāo)事件在JavaScript中的作用是什么?的詳細(xì)內(nèi)容,更多請(qǐng)關(guān)注www.92cms.cn其它相關(guān)文章!






