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.

Chapter 5 ✦ Body Text Objects (Chapter 19)<br />

aliqua. Ut enim adminim veniam, quis nostrud exercitation<br />

ullamco laboris nisi ut aliquip ex ea commodo consequat.<br />

<br />

<br />

toString()<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 see the results of the<br />

toString() method. Enter the following sequence of statements into the top<br />

text box:<br />

a = document.createRange()<br />

a.selectNode(document.getElementById(“myP”))<br />

a.toString()<br />

If you type only a into the top text box, you see the text contents of the range,<br />

but don’t be fooled. Internal workings of The Evaluator attempt to evaluate any<br />

expression entered into that text field. Assigning a range object to a text box forces<br />

an internal application of the toString() method (just as the Date object does<br />

when you create a new object instance in The Evaluator).<br />

selection Object<br />

Properties<br />

type<br />

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

Compatibility ✓ ✓ ✓<br />

Example<br />

Listing 19-7 contains a page that demonstrates several features of the selection<br />

object. When you make a selection with the Deselect radio button selected, you see<br />

the value of the selection.type property (in the statusbar) before and after the<br />

selection is deselected. After the selection goes away, the type property returns<br />

None.<br />

291<br />

selection.type

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

Saved successfully!

Ooh no, something went wrong!