An API and set of behaviors for traversing and manipulating XML and HTML documents.
document.documentElement var mystuff = document.getElementById("mystuff"); mystuff.innerHTML = "<p>Hello World!</p>"; mystuff.firstChild.appendChild(document.createTextNode(" Cruel, cruel, world!");
Check your browser against these specifications!
nl[2]
and nl.item(2)
return the same thing:for (var i=0; i<nl.length; i++) { var n = nl[i]; } // is equivalent to for (var i=0; i<nl.length; i++) { var n = nl.item(i); }
style
property gives you an interface to CSS.inline style(see MDN style).
Everything you ever wanted to know and then some...
How would you turn this sentence ? or ? or ?
Basic Rules:
node.cloneNode(true)
to make a copy.innerHTML
is very helpful but it invokes the parser.Using innerHTML
:
node.innerHTML = "<div class='bingo'><p>B3</p><p>I2</p><p>N4</p></div>";
Using the manipulation APIs:
var div = document.createElement("div"); div.setAttribute("class","bingo"); var p = document.createElement("p"); p.appendChild(document.createTextNode("B3")); div.appendChild(p); p = document.createElement("p"); p.appendChild(document.createTextNode("I2")); div.appendChild(p); p = document.createElement("p"); p.appendChild(document.createTextNode("N4")); div.appendChild(p); node.appendChild(div);