function checkwhere(e) { if (document.layers){ xCoord = e.x; yCoord = e.y; } else if (document.all){ xCoord = event.clientX; yCoord = event.clientY; } else if (document.getElementById){ xCoord = e.clientX; yCoord = e.clientY; } if (shipSize>0){ document.getElementById('movingShips').style.zIndex = -1; document.getElementById('movingShips').style.top = yCoord-10+'px'; document.getElementById('movingShips').style.left = xCoord-10+'px'; document.getElementById('movingShips').style.position = 'absolute'; } document.getElementById('divCoord').value = "X= "+ xCoord + " Y= " + yCoord; } document.onmousemove = checkwhere; // Calling the Mouse Coordinate Fantion
Tuesday, March 23, 2010
Sample Code Mouse Coordinates - JavaScript
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment