哪吒机器人提醒:

提醒:前端技术
【标题】IE中createElement需要注意的一个小问题
【摘要】最近有读者求助,说在iframe中,创建一个元素,然后添加到父页面中在ie6,ie7中行不通,而firefox和ie8可以。代码如下: var $alertpanel = $( document.createelement("div") ); $alertpanel.css("width","120px").css("height","50px").text("hello cssrain!"); $('body',parent.document).append($alertpanel);顺着他的意思,我也写了个demo,发现确实是这样。翻了翻资料,也没看到类似的问题。然后使用原生的dom方法写了一次,发现也不行,一样。 var div = document.createelement("div"); div.style.width = "120px"; div.style.height = "50px"; div.style.border = "solid 1px #000000"; div.innerhtml = "hello cssrain!"; pa... (04-14 10:46)