5. add the new element to the exact position;-->
<html>
<head>
<title>TestJS</title>
</head>
<body>
<div id="div1">
<p id="p1">This is the first paragraph</p>
<p id="p2">This is another paragraph</p>
</div>
<script type="text/javascript">
var newEle=document.createElement("h1");
var para=documentcreateTextNode("This is your headline");
newEle.appendChild(para);
<!--find the location-->
var oldEle=document.getElementById("div1");
oldEle.appendChild(newEle);
</script>
</body>
</html>
<!-- how to remove an element-->
<html>
<head>
<title>Remove an Element</title>
</head>
<body>
<div id="div1">
<p id="p1">This is a paragraph</p>
<p id="p2">This is another paragraph</p>
</div>
<script type="text/javascript">
var parent=document.getElementById("div1");
var child=document.getElementById("p2");
parent.removeElement(child);
</script>
</body>
</html>
always remember the steps.