2015-12-02 105 views
2

在这段代码中,为什么空分配不起作用?

<html> 
    <head> 
     <meta charset="UTF-8"> 

     <script> 
      window.onload = myfunc; 
      function myfunc(){ 
       window['document'] = null; 
       console.log(window['document']);  
      } 
     </script> 
    </head> 
    <body> 
     <h1>My First Web Page</h1> 
     <p>My first paragraph.</p> 
    </body> 
</html> 

尽管空分配,为什么DOM接口window['document']不为空?如下图所示...

enter image description here

+0

你想清楚页面的正文吗? –

+0

@JoseRocha是的,我想清除页面的正文。 (){ – overexchange

+2

'window.onload = function console.log(window ['document']); }' –

回答

相关问题