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']
不为空?如下图所示...
你想清楚页面的正文吗? –
@JoseRocha是的,我想清除页面的正文。 (){ – overexchange
'window.onload = function console.log(window ['document']); }' –