JavaScript IE加速

<!doctype html>
<html dir="ltr" lang="zh-CN">
  <head>
    <meta charset="utf-8"/>
    <title>javascript提速技术 by 司徒正美</title>
 
    <script type="text/javascript">
         var __chrome = navigator.userAgent.indexOf("Chrome") !== -1;
        var __firefox = !!window.Components

        if( !__chrome & !__firefox  ){
         
          var code = [],ri = 0,prop,str = "var "
          for(var a in window)
            code[ri++] = a;
          for (var i = 0 ,n = code.length;i<n;i++){
            var prop = code[i]
            window['_'+prop] = window[prop];
            str += prop+'=_'+prop+","
          }
          str = str.slice(0,-1);
          eval(str)
        }
var date = new Date;
for (var i = 0; i < 100000; i++)
 document;

alert(new Date - date);
 
    </script>
 
  </head>
  <body>
!!!!!!
  </body>
</html>

posted @ 2010-02-12 00:58  星火卓越  阅读(276)  评论(0编辑  收藏  举报