解决window.onresize事件多次调用问题:
- <script type="text/javascript">
- var resizeTimer = null;
- function doResize(){
- alert("width="+(document.documentElement||document.body).clientWidth +
- " Height="+(document.documentElement||document.body).clientHeight);
- }
- window.onresize = function(){
- if(resizeTimer) clearTimeout(resizeTimer);
- resizeTimer = setTimeout("doResize()",300);
- }
- </script>