HTML Dokument
<html>
<head>
<title> DOM Modifikation </title>
</head>
<body>
<h2>DOM Test</h2>
<ul compact="true" style="color:blue;border-style:dotted;">
<li id="one">eins</li>
<li id="two">eins</li>
<li id="three">eins</li>
</ul>
</body>
</html>
DOM Scripting
var header = document.getElementsByTagName("h2")[0],
body = header.parentNode;
window.alert("los ...");
body.removeChild(header);
window.alert("huch ...");
header = document.createElement("h1");
header.setAttribute("title", "neue Überschrift");
header.appendChild(document.createTextNode("Grosser DOM Test"));
body.insertBefore(header, body.firstChild);
window.alert(body.firstChild.nodeName);
var node = document.getElementById("two");
window.alert(node.innerHTML);
node.removeAttribute("id");
window.alert(node.parentNode.innerHTML);
[ Ausführen]