<div class="codetitle"> <span><a style="CURSOR: pointer" data="24650" class="copybut" id="copybut24650" onclick="doCopy('code24650')"><u>复代码</u></a></span> 代码如下:</div> <div class="codebody" id="code24650"> <br><script type="text/javascript"><! -- <BR>function GOOGLEResize(){ <BR>alert(1); <BR>} <BR>var ua=navigator.userAgent.toLowerCase(); <BR>var isStrict=document.compatMode=="CSS1Compat", <BR>isOpera=ua.indexOf("opera")>-1, <br>isSafari=(/webkit|khtml/).test(ua) , <br>isIE=ua.indexOf("msie")>-1, <br>isIE7=ua.indexOf("msie 7")>-1, <br>isGecko=!isSafari&&ua.indexOf("gecko ")>-1, <br>isBorderBox=isIE&&!isStrict, <br>isWindows=(ua.indexOf("windows")!=-1||ua.indexOf("win32")!=-1), <br>isMac=(ua.indexOf("macintosh")!=-1||ua.indexOf("mac os x")!=-1), <br>isLinux=(ua.indexOf("linux") !=-1), <br>isSecure=window.location.href.toLowerCase().indexOf("https")===0; <br>if(isGecko || isOpera) { <br> document.addEventListener("DOMContentLoaded", GOOGLEResize, false); <br>}else if(isIE){ <br> document.write("<s" 'cript id="ie-deferred-loader" defer="defer" src="/' '/:">< ;/s' "스크립트>"); <br> var defer = document.getElementById("ie-deferred-loader"); <br> defer.onreadystatechange = function(){ <br> if(this.readyState == "complete"){ <br> GOOGLEResize(); <br> } <br> }; <br>}else if(Ext.isSafari){ <br> docReadyProcId = setInterval(function(){ <br> var rs = document.readyState; <br> if(rs == "complete") { <br> GOOGLEResize (); <br> } <br> }, 10); <br>}else{ <br>window.onload=GOOGLEResize; <br>} <br>// --></script><br> </div> <br>其中对于IE的检测很有意思。 <br>以上代码,整理自Extjs的脚本,完全可以代替Ext.onReady를 사용합니다.