zoukankan      html  css  js  c++  java
  • JS 内存泄漏

    <!DOCTYPE HTML>
    <html>
    <body>
    
    Makes XHR request every 50ms. Watch the memory. Fixes XHR leak in older IEs.
    
    <script>
    onload = function() {
      setInterval(function(){
         var xhr = new XMLHttpRequest()
         xhr.open('GET', 'jquery.js', true)
         xhr.onreadystatechange = function() {
            if(this.readyState == 4 && this.status == 200) {            
               document.getElementById('test').innerHTML++
            }
         }
         xhr.send(null)
         xhr = null
      }, 50)
    }
    </script>
    <div id="test">0</div>
    
    </body>
    </html>
  • 相关阅读:
    边框
    文本样式
    框架
    表格
    列表
    标签
    常用类--包装类
    常见类 --Object
    日志
    异常
  • 原文地址:https://www.cnblogs.com/ok519/p/2871285.html
Copyright © 2011-2022 走看看