学艺不精 , 有问题请教 javascript appendChild
我的js html 水平很臭,前两天看了一个函数 appendChild ,我认为效果应该是这样
假设 <div id="d1" />
js:里
var d1 = document.getElementById("d1");
var d2 = document.createElement("div");
var textnode = document.createTextnode("hhh");
d2.appendChild(textnode);
d1.appendChild(d2);
结果是
<div id="d1"><div>hhh</div></div>
可是有个猩猩认为:
<div id="d1"/><div>hhh</div>
见
http://community.csdn.net/Expert/topic/3779/3779972.xml?temp=.6656305
不知谁对?请诸位老大帮忙