这是因为:
在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>