解决window.onresize事件多次调用问题

解决window.onresize事件多次调用问题:

Js代码
  1. <script type="text/javascript">   
  2. var  resizeTimer = null;   
  3.   
  4. function doResize(){   
  5.   alert("width="+(document.documentElement||document.body).clientWidth +    
  6.        "   Height="+(document.documentElement||document.body).clientHeight);   
  7. }   
  8.   
  9. window.onresize = function(){   
  10.   if(resizeTimer) clearTimeout(resizeTimer);   
  11.   resizeTimer = setTimeout("doResize()",300);   
  12. }   
  13. </script>  

你可能感兴趣的:(window)