15.02.2013 Views

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

414<br />

(IE) event.clientX<br />

<strong>JavaScript</strong> <strong>Examples</strong> <strong>Bible</strong>: The Essential Companion to <strong>JavaScript</strong> <strong>Bible</strong><br />

Listing 29-14: IE4+ Event Coordinate Properties<br />

<br />

<br />

X and Y Event Properties (IE4+)<br />

<br />

function checkCoords() {<br />

var form = document.forms[0]<br />

form.srcElemTag.value = “”<br />

form.clientCoords.value = event.clientX + “,” + event.clientY<br />

form.pageCoords.value = (event.clientX + document.body.scrollLeft) +<br />

“,” + (event.clientY + document.body.scrollTop)<br />

form.offsetCoords.value = event.offsetX + “,” + event.offsetY<br />

form.screenCoords.value = event.screenX + “,” + event.screenY<br />

form.xyCoords.value = event.x + “,” + event.y<br />

form.parElem.value = “”<br />

return false<br />

}<br />

function handleSize() {<br />

document.forms[0].resizeCoords.value = event.clientX + “,” + event.clientY<br />

}<br />

<br />

<br />

<br />

X and Y Event Properties (IE4+)<br />

<br />

Click on the button and in the DIV/image to see the coordinate values for the<br />

event object.<br />

<br />

<br />

IE Mouse Event Coordinates:<br />

srcElement:<br />

clientX, clientY:<br />

...With scrolling:<br />

offsetX, offsetY:<br />

screenX, screenY:<br />

x, y:<br />

...Relative to:<br />

<br />

<br />

Window Resize Coordinates:<br />

clientX, clientY:<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!