点击按钮,会动态创建一个iframe,并制定src目录,在加载这个链接期间,主页面的鼠标和键盘事件都失效了,比如随意点击页面上另外的input框,没有反应。这种情况只在IE下存在,CHROME下可以同时加载IFRAME,并且可以在主页面上随意操作。附页面:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">
function createIframe(){
var iframe = document.createElement("iframe");
iframe.src = "http://www.163.com";
document.body.appendChild(iframe);
}
</script>
</head>
<body>
<input id="bbb" width="200px" type="text"/><br/>
<input width="200px" type="text"/><br/>
<input width="200px" type="text"/><br/>
<input width="200px" type="text"/><br/>
<input width="200px" type="text"/><br/>
<input width="200px" type="text"/><br/>
<input width="200px" type="text"/><br/>
<input width="200px" type="text"/><br/>
IE浏览器下,点击按钮之后,在iframe完全加载成功之前,随意点击上面的input没反应(chrome是没有问题的)<br/>
<input width="200px" type="button" value="点我" onclick="createIframe()"/><br/>
<div id="aaa"></div>
</body>
</html>iframe
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">
function createIframe(){
var iframe = document.createElement("iframe");
iframe.src = "http://www.163.com";
document.body.appendChild(iframe);
}
</script>
</head>
<body>
<input id="bbb" width="200px" type="text"/><br/>
<input width="200px" type="text"/><br/>
<input width="200px" type="text"/><br/>
<input width="200px" type="text"/><br/>
<input width="200px" type="text"/><br/>
<input width="200px" type="text"/><br/>
<input width="200px" type="text"/><br/>
<input width="200px" type="text"/><br/>
IE浏览器下,点击按钮之后,在iframe完全加载成功之前,随意点击上面的input没反应(chrome是没有问题的)<br/>
<input width="200px" type="button" value="点我" onclick="createIframe()"/><br/>
<div id="aaa"></div>
</body>
</html>iframe
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货