javascript错误解决:Unable to modify the parent container element before the child element is closed

网页错误详细信息

用户代理: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 2.0.50727; .NET CLR 1.1.4322; InfoPath.1)
时间戳: Wed, 16 Feb 2011 03:10:40 UTC


消息: HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917)
行: 0
字符: 0
代码: 0
解决方法:

1、设置一个IF 判断

  1. document.readyState == "complete"

或者是

  1. If(document.all && document.body.readyState=="complete"){

这样,等页面加载成功以后,执行相关js,就可以避免上面的错误。

2、土办法:设置

  1. setTimeOut('func',3000);

这个就是从页面加载的时候,数三秒,再执行func,就可以。不过这个方法不精准。

推荐第一种。

 

posted @ 2011-02-16 11:13  dodo-yufan  阅读(2971)  评论(0编辑  收藏  举报