标签: javascript html
我试图将一个div放在另一个div中
<div id="test"> <img src="img/sky.jpg"> this is a test </div> function inner(){ var abc = document.getElementById("test"); document.getElementById("main").innerHTML = abc; } </script>
它不起作用。它有可能吗?
答案 0 :(得分:4)
使用.appendChild():
document.getElementById("main").appendChild( abc );