<html>
<head>
<title>Sample code - Traversing an HTML Table with Javascript and DOM Interfaces</title>
<script>
	function start() {
	     myDocumentElements=document.getElementsByTagName("body");
  	     myBody=myDocumentElements.item(0);
	     myBodyElements=myBody.getElementsByTagName("p");
	     myP=myBodyElements.item(1);

	     myTextNode=document.createTextNode("world");
	     myP.appendChild(myTextNode);

	     myNewPTAGnode=document.createElement("p");
	     myBody.appendChild(myNewPTAGnode);

	     myP.removeChild(myTextNode);
	     myNewPTAGnode.appendChild(myTextNode);
	}
</script>
</head>
<body onload="start()">
<p>hi</p>
<p>hello</p>
</body>
</html>