[求助]请您讲解下面的HTML程序段
我是从网上看到的,但是有些地方看不懂,请您讲解,谢谢!!请问document.getElementById("paragraph1").appendChild(newElem)是什么意思?appendChild又是什么意思?
<html >
<head>
<title>A Simple Page</title>
</head>
<script language="javascript">
function newElement()
{
var newElem = document.createElement("p");
newElem.setAttribute("id","newP");
var newText = document.createTextNode("This is the second paragraph.");
//newElem.setAttribute("appendChild","newText");
newElem.appendChild(newText);
for(var i=0;i<5;i++)
{
document.getElementById("paragraph1").appendChild(newElem);
}
}
</script>
<body>
<div id="paragraph1">
This is the one and only
paragraph on the page.
</div>
<input name="" type="button" value="Click here!" onclick="newElement()" />
</body>
</html>