很明显,你的 two()产生了循环调用

解决方案 »

  1.   

    window.setTimeout(function(){var xs = new testx();},0);
    或:
    window.onload = function(){new testx()}
      

  2.   

    确实是死循环了,这样就可以了,但在firefox下还是不行在ie下还可以在
    firefox下不认document.body.complete
    <html>
    <head>
    <title>测试</title>
    </head>
    <body>
    <script>
    var testx = function(){
        this.two();
    }
    testx.prototype.two = function (){
        if (document.body.readyState== "complete"){
            this.three();
        }else {
            setTimeout(this.two(),100);
        }
    }
    testx.prototype.three = function (){
        alert(3);
    }
    var xs = new testx();
    </script>
    </body>
    </html>