修正IE6 IE7的window.resize bug
2010-04-15 15:08
309 查看
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta content="IE=6" http-equiv="X-UA-Compatible"/>
<title>fix ie6 resize bug by 司徒正美</title>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<title>Resize</title>
<script type="text/javascript">
if(!Array.prototype.map)
Array.prototype.map = function(fn,scope) {
var result = [],ri = 0;
for (var i = 0,n = this.length; i < n; i++){
if(i in this){
result[ri++] = fn.call(scope ,this[i],i,this);
}
}
return result;
};
var getWindowSize = function(){
return ["Height","Width"].map(function(name){
return window["inner"+name] ||
document.compatMode === "CSS1Compat" && document.documentElement[ "client" + name ]
|| document.body[ "client" + name ]
});
}
window.onload = function(){
if(!+"\v1" && !document.querySelector) { // for IE6 IE7
document.body.onresize = resize;
} else {
window.onresize = resize;
}
var text = document.getElementById("text")
function resize() {
text.innerHTML = getWindowSize().join(" : ");
}
}
</script>
</head>
<body>
<h1>修正IE6 IE7中window.onresize 被多次执行的bug</h1>
<div id="text">这里是用来显示窗口大小</div>
</body>
</html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta content="IE=6" http-equiv="X-UA-Compatible"/>
<title>fix ie6 resize bug by 司徒正美</title>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<title>Resize</title>
<script type="text/javascript">
if(!Array.prototype.map)
Array.prototype.map = function(fn,scope) {
var result = [],ri = 0;
for (var i = 0,n = this.length; i < n; i++){
if(i in this){
result[ri++] = fn.call(scope ,this[i],i,this);
}
}
return result;
};
var getWindowSize = function(){
return ["Height","Width"].map(function(name){
return window["inner"+name] ||
document.compatMode === "CSS1Compat" && document.documentElement[ "client" + name ]
|| document.body[ "client" + name ]
});
}
window.onload = function(){
if(!+"\v1" && !document.querySelector) { // for IE6 IE7
document.body.onresize = resize;
} else {
window.onresize = resize;
}
var text = document.getElementById("text")
function resize() {
text.innerHTML = getWindowSize().join(" : ");
}
}
</script>
</head>
<body>
<h1>修正IE6 IE7中window.onresize 被多次执行的bug</h1>
<div id="text">这里是用来显示窗口大小</div>
</body>
</html>
相关文章推荐
- 修正IE6 IE7的window.resize bug
- 修正IE6 IE7的window.resize bug
- 修正IE6 IE7的window.resize 死循环bug
- IE6 IE7上的window.resize bug
- 在IE6,IE7 中 window.onresize 被多次执行
- 解决window.opener=null;window.close(),只支持IE6不支持IE7,IE8的问题
- 请教:window server 2003从IE6升级为IE7后,.net启动出现问题。
- IE中伪类:hover的使用及BUG,以及如何在IE6中进行修正(CSS)
- ie6,ie7,ie8 css bug兼容解决记录
- 2013年ie6,ie7,ie8 css bug兼容解决方法集合
- 修正IE6不支持position:fixed的bug
- ie6,ie7 z-index bug
- 修正IE6不支持position:fixed的bug
- ie6,ie7,ie8 css bug兼容解决记录
- 修正IE6不支持position.fixed的bug
- Fancybox在ie6下关闭按扭及阴影效果不显示的bug的修正
- ie6,ie7,ie8 css bug兼容解决记录
- ie6,ie7的bug
- IE6 IE7 IE8 css bug兼容性解决方法总结归纳
- 【技术】ie6,ie7,ie8 css bug汇总以及兼容解决方法