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

}<br />

function append(form) {<br />

var newItem = makeNewLI(form.input.value)<br />

var lastLI = document.getElementById(“myList”).lastChild<br />

document.getElementById(“myList”).appendChild(newItem)<br />

}<br />

function replaceFirst(form) {<br />

var newItem = makeNewLI(form.input.value)<br />

var firstLI = document.getElementById(“myList”).firstChild<br />

document.getElementById(“myList”).replaceChild(newItem, firstLI)<br />

}<br />

function replaceLast(form) {<br />

var newItem = makeNewLI(form.input.value)<br />

var lastLI = document.getElementById(“myList”).lastChild<br />

document.getElementById(“myList”).replaceChild(newItem, lastLI)<br />

}<br />

<br />

<br />

<br />

firstChild and lastChild Property Lab<br />

<br />

<br />

Enter some text to add to or replace in the OL element:<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

Initial Item 1<br />

Initial Item 2<br />

Initial Item 3<br />

Initial Item 4<br />

<br />

<br />

<br />

height<br />

width<br />

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

Compatibility ✓ ✓ ✓ ✓ ✓<br />

23<br />

elementObject.height

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

Saved successfully!

Ooh no, something went wrong!