이벤트가 트리거되면 screenY 마우스 이벤트는 마우스 포인터의 수직 좌표를 반환합니다.
예시
다음 코드를 실행하여 screenY를 구현하는 방법을 배울 수 있습니다. JavaScript의 마우스 이벤트.
<!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>