[Reprint] solution to "unable to open Internet site terminated operation"
16:59:03 technology | comments (0) | browsed (5804) wrote a Javascript script for the pop-up advertisement. The result is normal in Firefox, internet Explorer prompts "unable to open the Internet site has terminated operation" error. After a Google review, I found the cause of the problem after finding N for a long time.
This article from cnlei. blog (http://www.cnlei.org/blog/article.asp? Id = 501) by cnlei
In IE, when the page has not been fully loaded, if the JavaScript code being executed contains the document. if createelement is used, page loading may fail. the message "Internet sites e cannot open Internet site http://www.xxx.com/xxx/xxx.html terminated operation" is displayed ".
This is because:
In IE, during the document loading process, the DOM structure of the entire HTML document has not yet been completely generated, and the JavaScript code being executed has created a new Dom node, the structure of the DOM tree is disordered.
Error-prone Syntax:
<HTML>
<Head>
<Title> xxxxxxxxxxxx </title>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Meta name = "author" content = "fengyan, cnlei"/>
<Meta name = "Copyright" content = "cnlei.y.l@gmail.com, http://www.cnlei.com"/>
<Meta name = "keywords" content = ""/>
<Meta name = "Description" content = ""/>
</Head>
<Body>
Xxxxxxxxxxxxxxxxxx
<SCRIPT type = "text/JavaScript">
<! --
(Function Init (){
$ Win (). Create ({// create a complex HTML Structure
ID: "lwindow_reg ",
Title: "registering a new user ",
Type: "ajax ",
Innerhtml: 'ex_reg.html'
},{
Top: "50px ",
Left: "270px ",
Width: "560px"
});
})();
-->
</SCRIPT>
Xxxxxxxxxxxxxxxxxx
</Body>
</Html>
Solution:
<HTML>
<Head>
<Title> xxxxxxxxxxxx </title>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Meta name = "author" content = "fengyan, cnlei"/>
<Meta name = "Copyright" content = "cnlei.y.l@gmail.com, http://www.cnlei.com"/>
<Meta name = "keywords" content = ""/>
<Meta name = "Description" content = ""/>
</Head>
<Body>
Xxxxxxxxxxxxxxxxxx
<SCRIPT type = "text/JavaScript">
<! --
(Function (){
Function Init (){
$ Win (). Create ({// create a complex HTML Structure
ID: "lwindow_reg ",
Title: "registering a new user ",
Type: "ajax ",
Innerhtml: 'ex_reg.html'
},{
Top: "50px ",
Left: "270px ",
Width: "560px"
});
};
If (! DWS. BV. isie) {// non-IE browser direct Initialization
Init ();
} Else {
// In IE, prevent the browser from prompting "Internet website e cannot open the Internet site"
If (document. readystate = "complete "){
Init ();
} Else {
Document. onreadystatechange = function (){
If (document. readystate = "complete") Init ();
}
}
}
})();
-->
</SCRIPT>
Xxxxxxxxxxxxxxxxxx
</Body>
</Html>