日期:2014-05-17 浏览次数:21258 次
<!doctype html>
<body>
<div id="show">0</div>
<div id="div" style="border:1px solid #000"></div>
<script>
var i = 0;
div.onresize = function(){ show.innerHTML = ++i; }
setTimeout('div.innerHTML="test"', 1000)
setTimeout('div.style.height="50px"', 2000)
</script>
</body>
</html>
<!doctype html>
<style>html,body{border:5px solid #06F;}</style>
<body><div id="div" style="height:100px;"></div></body>
</html>
<script>
window.onresize = function(){ div.innerHTML += "window, "; }
//document.documentElement.onresize = function(){ div.innerHTML += "documentElement, "; }
//document.body.onresize = function(){ div.innerHTML += "body, "; }
</script>
this.resizeDelay = function(){
    var clientWidth = container.clientWidth,
        clientHeight = container.clientHeight;
    if( clientWidth != width || clientHeight != height ) {
        width = clientWidth; height = clientHeight;
        oThis._delay( oThis.resize );
    }
};
<!doctype html>
<script>
    window.onload = function() {
        var div=document.getElementById("div");
        var i = 0;
        div.onresize = function() {
            show.innerHTML = "触发了resize事件";
        }
        setTimeout(function(){
           div.innerHTML="test";
        }, 1000)
        setTimeout(function(){
           div.style.height="50px"
        }, 2000)
    }
</script>
<div id="show">0</div>
<div id="div" style=&