您好,欢迎访问一九零五行业门户网

IE8 下的Js错误HTML Parsing Error..._javascript技巧

网页错误详细信息
用户代理: mozilla/4.0 (compatible; msie 8.0; windows nt 6.1; wow64; trident/4.0; qqdownload 551; slcc2; .net clr 2.0.50727)
时间戳: wed, 12 aug 2009 07:02:03 utc
消息: html parsing error: unable to modify the parent container element before the child element is closed (kb927917)
行: 0
字符: 0
代码: 0
今天调试一段js代码出现这个状况..在火狐 ie7 和ie6下都正常...郁闷,在网上搜索了一下相关资料 一般错误都是指所指定的标签没有加载完就是用该对象....
检查了代码 从表面上看没有什么问题
如下
var bgobj = document.createelement(div); 
        bgobj.style.csstext = position:absolute;left:0px;top:0px;width:+iwidth+px;height:+math.max(document.body.clientheight, iheight)+px;filter:alpha(opacity=30);opacity:0.3;background-color:#000000;z-index:101;; 
        document.body.appendchild(bgobj);
其实 仔细检查出来就发现 这段代码会在body没有加载完毕之前运行....
问题就出在这里....
所以 代码只能放在波电压外面去执行
var bgobj = document.createelement(div); 
        bgobj.style.csstext = position:absolute;left:0px;top:0px;width:+iwidth+px;height:+math.max(document.body.clientheight, iheight)+px;filter:alpha(opacity=30);opacity:0.3;background-color:#000000;z-index:101;; 
        document.body.appendchild(bgobj);
这样ok没问题了...看来ie 的逻辑性越来越强了.....可能以前很多代码都会出现这种问题咯
其它类似信息

推荐信息