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.

418<br />

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

Figure 13-1: onMouseOver event object knows whence the pointer<br />

came.<br />

This is a good example to experiment with in the browser, because it also reveals<br />

a potential limitation. The element registered as the toElement or fromElement<br />

must fire a mouse event to register itself with the browser. If not, the next element<br />

in the sequence that registers itself is the one acknowledged by these properties.<br />

For example, if you roll the mouse into the center box and then extremely quickly<br />

roll the cursor to the bottom of the page, you may bypass the South box entirely.<br />

The text that appears in the statusbar is actually the inner text of the BODY element,<br />

which is the element that caught the first mouse event to register itself as the<br />

toElement for the center table cell.<br />

keyCode<br />

(IE) event.keyCode<br />

NN2 NN3 NN4 NN6 IE3/J1 IE3/J2 IE4 IE5 IE5.5<br />

Compatibility ✓ ✓ ✓<br />

Example<br />

Listing 29-16 provides an additional play area to view the keyCode property for<br />

all three keyboard events while you type into a TEXTAREA. You can use this page<br />

later as an authoring tool to grab the precise codes for keyboard keys you may not<br />

be familiar with.

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

Saved successfully!

Ooh no, something went wrong!