這是因為:
在IE下,在載入文檔的過程中,整個HTML文檔的DOM結構尚未產生完整,而此時正在執行的JS就已建立出新的DOM結點了,致使DOM樹的結構發生紊亂.
易出錯寫法: 複製代碼 代碼如下:<html>
<head>
<title> xxxxxxxxxxxx </title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="author" content="楓岩,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({//建立複雜HTML結構
id:"lWindow_Reg",
title:"註冊新使用者",
type :"AJAX",
innerHTML:'ex_reg.html'
},{
top:"50px",
left:"270px",
width:"560px"
});
})();
-->
</script>
xxxxxxxxxxxxxxxxxx
</body>
</html>
解決方案: 複製代碼 代碼如下:<html>
<head>
<title> xxxxxxxxxxxx </title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="author" content="楓岩,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({//建立複雜的HTML結構
id:"lWindow_Reg",
title:"註冊新使用者",
type :"AJAX",
innerHTML:'ex_reg.html'
},{
top:"50px",
left:"270px",
width:"560px"
});
};
if(!DWS.BV.isIE){//非IE瀏覽器直接初始化
init();
} else {
//IE下,防止瀏覽器提示“internet explore 無法開啟internet網站 已終止操作”
if (document.readyState=="complete"){
init();
} else {
document.onreadystatechange=function(){
if(document.readyState=="complete")init();
}
}
}
})();
-->
</script>
xxxxxxxxxxxxxxxxxx
</body>
</html>