学员:徐豫锋提问时间:2008-06-23 07:28:12
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script language="javascript" type="text/javascript">
function ok() {
var p=document.createElement("p");
p.innerHTML="添加的内容";
document.appendchild(p);//这句有什么问题
alert("添加段落成功");
}
</script>
</head>
<body>
<script type="text/javascript">
ok();
</script>
</body>自己写的,我估计是这句有问题。document.appendchild(p)
应该是怎样啊?
回答人:姜昊回答时间:2008-06-25 14:15:23
function ok() {
var p=document.createElement("p");
//document.body.appendChild(p);
var htmlrootElement = document.documentElement;
htmlrootElement.appendChild(p);
p.innerHTML="添加的内容";
alert("添加段落成功");
}
汗。。。。你发的重复的问题贴吧。。。。
学员对该答案的评价 谢谢