appendChild不起作用了?
<div id="placeholder"></div>
var placeholder=document.getElementById("placeholder");
var description="test";
placeholder.appendChild(description);
,为什么第二行代码就是不生效。。。。求解!
[解决办法]
<!DOCTYPE HTML>
<html>
<head>
<meta charset="gbk" />
<title></title>
</head>
<body>
<div id="placeholder"></div>
<script type="text/javascript">
var placeholder = document.getElementById("placeholder");
var description = "test";
placeholder.innerHTML = description;
// 或者
var textNode = document.createTextNode('test123');
placeholder.appendChild( textNode )
</script>
</body>
</html>