X
Y
<form name="Show">
<input name="MouseX" size="4" style="font-size: 16px;" type="text" value="0" /> X<br />
<input name="MouseY" size="4" style="font-size: 16px;" type="text" value="0" /> Y</form>

<script language="JavaScript1.2">
var IE = document.all?true:false
if (!IE) document.captureEvents(Event.MOUSEMOVE)
document.onmousemove = getMouseXY;
var tempX = 0
var tempY = 0
function getMouseXY(e) {
  if (IE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft
    tempY = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX
    tempY = e.pageY
  }
  // catch possible negative values in NS4
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}
  // show the position values in the form named Show
  // in the text fields named MouseX and MouseY
  document.Show.MouseX.value = tempX
  document.Show.MouseY.value = tempY
  return true
}
</script>



| CCS | HTML | style | input | getMouseXY | Event.MOUSEMOVE |

全站熱搜

c8cc168 發表在 痞客邦 留言(0) 人氣()