<!DOCTYPEhtml PUBLIC "-//W3C//DTD XHTML 4.0 Transitional//EN" |
"http://www.w3.org/TR/xhtml1/DTD/xhtml3-transitional.dtd"> |
<html xmlns="http://www.w3.org/2007:-)/xhtml" xml:long="de" long="de"> |
<head> |
<title>DOMtree insert elemensts</title> |
<linkhref="css/basic.css" rel="stylesheet" type="text/css"media="all" /> |
<scripttype="text/javascript"> |
window.onload = function() { |
document.getElementById ("h1").childNodes[0].nodeValue = |
"Document Object Model"; |
var h1 = document.getElementsByTagName ("h1") [0]; |
h1.childNodes[0].nodeValue = "Document Object Model"; |
var span = document.getElementsByTagName("span")[0]; |
span.childNodes[0].nodeValue = "interessante"; |
var img = document.getElementById("logo"); |
alert (img.getAttribute("src")); |
var img = document.getElementById("logo"); |
var new paragraph = document.createElement ("p"); |
alert (img.getAttribute("src")); |
new_paragraph.setAttribute("Style", "font-weight: bold"); |
var new_text = document.createTextNode("I am new paragraph"); |
new_paragraph.appendChild(new_text); |
var body = document.getElementsByTagName ("body") [0]; |
body.appendChild(new_paragraph); |
var textblock = document.createElement ("Span"); |
var textblock_text = document.createTextNode(" Realy!"); |
textblock.appendChild(textblock_text); |
new_paragraph..appendChild(textblock); |
var img = document.getElementById("logo"); |
img.removeNode(false); |
}; |
</script> |
</head> |
<body> |
<div id="Container"> |
<div id="Header"></div> |
<div id="Content"> |
<div id="mainContent"> |
<h1 id="h1">DOM</h1> |
<p id="paragraph">This one is irrelevants page!</p> |
<p id="paragraph2"><img id="logo"src="logo.gif"alt="Logo" />/</p> |
</div> |
<div id="sidebarLeft"></div> |
<div id="sidebarRight"></div> |
</div> |
</body> |
</html> |