當前位置:編程學習大全網 - 網站源碼 - js如何獲取鼠標在某元素移動時~鼠標指針在元素中的坐標?

js如何獲取鼠標在某元素移動時~鼠標指針在元素中的坐標?

稍等上代碼!!

<html>

<head>

<script?type="text/javascript">

function?show_coords(event){

var?x?=?event.clientX;

var?y?=?event.clientY;

var?say?=?document.all("coords");

say.innerHTML?=?"X:"+x+"?Y:"+y;

say.style.position?=?"absolute";

say.style.left?=?x?+?30;

say.style.top?=?y;

}

</script>

</head>

<body?onmousemove="show_coords(event)">

<p?id="coords"></p>

</body>

<html>

希望我的回答對妳有用,有用就采納!!!謝謝!

  • 上一篇:做好了壹份榮譽證書的內容,但是不知道怎樣打印,才設置成空白證書的中間格式?
  • 下一篇:《cf》新出的戰術背包有什麽用?
  • copyright 2024編程學習大全網