文件撰写(”

时间:2011-08-04 17:58:49

标签: javascript internet-explorer-7 internet-explorer-6 document

嗨我在内联Javascript中创建一个div ...在IE 7中立即关闭只有剩下的浏览器会在我们编写document.write('')时关闭标记...

document.write('<div id="container" style="position:relative;width:234px;height:160px;overflow:hidden;border:0px;">')

1 个答案:

答案 0 :(得分:2)

var dynamicDiv = document.createElement("div");
dynamicDiv.id = "container";
dynamicDiv.style.position = "relative";
dynamicDiv.style.width = "234px";
dynamicDiv.style.height = "160px";
dynamicDiv.style.overflow = "hidden";
dynamicDiv.style.border = "0px";
document.body.appendChild(dynamicDiv);

这就是我如何进行DOM突变。