이 기사에서는 JS 웹 페이지에서 온라인으로 마우스 좌표 값을 얻는 방법에 대해 설명합니다. 참조를 위해 공유하십시오. 특정 구현 방법은 다음과 같습니다.
다음과 같이 코드를 복사하십시오. <html>
<헤드>
<meta http-equiv = "content-type"content = "text /html; charset = gb2312" />
<title> 표시 마우스 좌표 </title>
</head>
<body onmouseMove = "micro $ oftMousEmove ()">
<script language = "javaScript">
if (navigator.appName == 'netscape')
{
문서 .captureEvents (event.mouseMove);
document.onmouseMove = netScapemouseMove;
}
함수 netscapemouseMove (e) {
if (e.screenx! = docum
{
document.test.x.value = e.screenx;
document.test.y.value = e.screeny;
}
}
함수 micro $ oftmouseMove () {
if (window.event.x! = docum
{
document.test.x.value = Window.event.x;
document.test.y.value = Window.event.y;
}
}
</스크립트>
<양식 이름 = "테스트">
x : <입력 유형 = "text"name = "x"size = "4">
y : <입력 typue = "text"name = "y"size = "4">
</form>
</body>
</html>
이 기사가 모든 사람의 JavaScript 프로그래밍에 도움이되기를 바랍니다.