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.

262<br />

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

Example<br />

See Listing 19-8 (in Chapter 5 of this book) for an example of the<br />

createTextRange() method in action.<br />

doScroll([“scrollAction”])<br />

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

Compatibility ✓ ✓<br />

Example<br />

Use The Evaluator (Chapter 13 in the <strong>JavaScript</strong> <strong>Bible</strong>) to experiment with the<br />

doScroll() method in IE5+. Size the browser window so that at least the vertical<br />

scrollbar is active (meaning it has a thumb region). Enter the following statement<br />

into the top text field and press Enter a few times to simulate clicking the PgDn key:<br />

document.body.doScroll()<br />

Return to the top of the page and now do the same for scrolling by the increment of<br />

the scrollbar down arrow:<br />

document.body.doScroll(“down”)<br />

You can also experiment with upward scrolling. Enter the desired statement in<br />

the top text field and leave the text cursor in the field. Manually scroll to the bottom<br />

of the page and then press Enter to activate the command.<br />

Event Handlers<br />

onAfterPrint<br />

onBeforePrint<br />

See the onAfterPrint event handler for the window object, Chapter 16 of the<br />

<strong>JavaScript</strong> <strong>Bible</strong>.<br />

onScroll<br />

document.body.onScroll<br />

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

Compatibility ✓ ✓ ✓<br />

Example<br />

Listing 18-21 is a highly artificial demonstration of what can be a useful tool for<br />

some page designs. Consider a document that occupies a window or frame, but one<br />

that you don’t want scrolled, even by accident with one of the newer mouse wheels

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

Saved successfully!

Ooh no, something went wrong!