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.

}<br />

Chapter 1 ✦ Generic HTML Element Objects (Chapter 15)<br />

if (document.all.myUL) {<br />

document.all.myUL.firstChild.swapNode(document.all.myUL.lastChild)<br />

}<br />

if (document.all.myOL) {<br />

document.all.myOL.firstChild.swapNode(document.all.myOL.lastChild)<br />

}<br />

// remove last node<br />

function remove() {<br />

if (document.all.myUL) {<br />

document.all.myUL.lastChild.removeNode(true)<br />

}<br />

if (document.all.myOL) {<br />

document.all.myOL.lastChild.removeNode(true)<br />

}<br />

}<br />

<br />

<br />

<br />

Node Methods<br />

<br />

Here is a list of items:<br />

<br />

First Item<br />

Second Item<br />

Third Item<br />

Fourth Item<br />

<br />

<br />

&nbsp;&nbsp;<br />

&nbsp;&nbsp;<br />

&nbsp;&nbsp;<br />

<br />

<br />

<br />

You can accomplish the same functionality shown in Listing 15-31 in a crossbrowser<br />

fashion using the W3C DOM. In place of the removeNode() and<br />

replaceNode() methods, use removeChild() and replaceChild() methods to<br />

shift the point of view (and object references) to the parent of the UL and OL<br />

objects: the document.body. Also, you need to change the document.all references<br />

to document.getElementById().<br />

scrollIntoView(topAlignFlag)<br />

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

Compatibility ✓ ✓ ✓<br />

89<br />

elementObject.scrollIntoView()

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

Saved successfully!

Ooh no, something went wrong!