87,907
社区成员
发帖
与我相关
我的任务
分享
<html>
<head>
<title></title>
<script language="javascript" type="text/javascript">
var div=document.createElement("div");
div.innerHTML="被添加的div";
//如果直接document.body.appendChild(div); 则失败.
//document.write("<span></span>"); //添加这行,document.body.appendChild(div) 成功.
//document.write(" "); //document.body.appendChild(div); IE下成功,FF,Chrome失败.
//document.write(" "); //document.body.appendChild(div); 失败.
document.body.appendChild(div);
</script>
</head>
<body></body>
</html>