One
I've seen it again.
IE8 reported the following error, but my machine is not reported, colleagues of the machine, tried 4, two newspaper, two do not report, IE version is the same, did not want to understand
Solve:
1, to see if there are not closed HTML tags, such as <table> without </table> (I am the reason)
2, whether the page is not loaded before the JS code to operate the body elements, the relevant JS code to move to </body> behind
Page Error Details
User agent: mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; trident/4.0; SLCC2. NET CLR 2.0.50727;. NET CLR 3.5.30729;. NET CLR 3.0.30729; Media Center PC 6.0)
Timestamp: Wed, APR 08:33:56 UTC
Message: HTML parsing error:unable To modify the parent container element before the child element is closed (KB927917)
Line: 0
Character: 0
Code: 0
Uri:
http://support.microsoft.com/kb/927917
Two
It occurs because some DOM operations occur before the DOM tree load is complete, such as AppendChild
Just like the following code:
<body>
<div>
<script type= "Text/javascript" >
alert (document.readystate);
var odiv = document.createelement ("DIV");
odiv.innerhtml = ' Test odiv test odiv ';
Document.body.appendChild (ODIV);
</script>
</div>
</body>
When parsing to the div began to appendchild on the body, and this time the body was not fully ready (It is not fully loaded), the document structure is still between loading and interactive state, so you will get the above error. Of course, this error is now exactly known to exist in the two versions of IE6 and IE7 (not tested by IE6) and an HTML parsing error will be found in IE8: HTML parsing error:unable to modify the parent container element before the child element is closed (KB927917)
1. To solve this problem, you can make a document.readystate state judgment, when it is complete, then do the appropriate operation, or to the script tag with the defer attribute (this property in the IE8 has not been supported).
2. Or
JS added settimeout ("xxxx ()", 1000), so that it gets enough time to load the execution target (XXXX) function, so the problem is resolved