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 1 ✦ Generic HTML Element Objects (Chapter 15)<br />

anim id est laborum Et harumd und lookum like Greek to me, dereud<br />

facilis est er expedit distinct.<br />

<br />

<br />

<br />

<br />

<br />

Because the z-index style property of the hiliter element is set to -1, the element<br />

always appears beneath the primary content on the page. If the user selects a<br />

line number beyond the current number of lines in the main element, the hiliter<br />

element is hidden.<br />

getClientRects()<br />

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

Compatibility ✓ ✓<br />

Example<br />

See Listing 15-27, which demonstrates the differences between getClientRects()<br />

and getBoundingClientRect() and shows how you can use the two together.<br />

getElementsByTagName(“tagName”)<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 />

getElementsByTagName() method. Enter the following statements one at a time<br />

into the upper text box and study the results:<br />

document.body.getElementsByTagName(“DIV”)<br />

document.body.getElementsByTagName(“DIV”).length<br />

document.getElementById(“myTable”).getElementsByTagName(“TD”).length<br />

Because the getElementsByTagName() method returns an array of objects, you<br />

can use one of those returned values as a valid element reference:<br />

document.getElementsByTagName(“FORM”)[0].getElementsByTagName(“INPUT”).length<br />

73<br />

elementObject.getElementsByTagName()

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

Saved successfully!

Ooh no, something went wrong!