<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);

	     myWhiteSpace=document.createTextNode(" ");

	     // first parameter is the new element 
	     // second parameter is the ref element
	     myP.insertBefore(myWhiteSpace,myTextNode);
	}
</script>
</head>
<body onload="start()">
<p>hi</p>
<p>hello</p>
</body>
</html>