15.02.2013 Views

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

114<br />

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

elementObject.onKeyDown<br />

Listing 15-41 (continued)<br />

function restoreModifiers(ext) {<br />

document.getElementById(“shift” + ext).style.backgroundColor = “#ffffff”<br />

document.getElementById(“ctrl” + ext).style.backgroundColor = “#ffffff”<br />

document.getElementById(“alt” + ext).style.backgroundColor = “#ffffff”<br />

}<br />

<br />

<br />

<br />

Keyboard Event Handler Lab<br />

<br />

<br />

<br />

onKeyDownonKeyPressonKeyUp<br />

Key Codes<br />

0<br />

0<br />

0<br />

<br />

Char Codes (IE5/Mac; NN6)<br />

0<br />

0<br />

0<br />

<br />

Modifier Keys<br />

Shift<br />

Shift<br />

Shift<br />

<br />

<br />

Ctrl<br />

Ctrl<br />

Ctrl<br />

<br />

<br />

Alt<br />

Alt<br />

Alt<br />

<br />

<br />

<br />

<br />

<br />

Spend some time with this lab, and try all kinds of keys and key combinations<br />

until you understand the way the events and key codes work.

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

Saved successfully!

Ooh no, something went wrong!