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.

276<br />

Range.collapsed<br />

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

Methods<br />

start()<br />

stop()<br />

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

Compatibility ✓ ✓ ✓<br />

Example<br />

See Listing 19-3 earlier in this chapter for examples of both the start() and<br />

stop() methods, which are invoked in event handlers of separate controlling buttons<br />

on the page. Notice, too, that when you have the behavior set to slide, stopping<br />

and restarting the MARQUEE does not cause the scroll action to start from a<br />

blank region.<br />

Range Object<br />

Properties<br />

collapsed<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 />

collapsed property. Reload the page and assign a new range to the a global variable<br />

by typing the following statement into the top text box:<br />

a = document.createRange()<br />

Next, set the range to encompass a node:<br />

a.selectNode(document.body)<br />

Enter a.collapsed into the top text box . The expression returns false because<br />

the end points of the range are not the same.

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

Saved successfully!

Ooh no, something went wrong!