![](/img/trans.png)
[英]What is the difference between calling the DOM method appendChild directly on document.body versus first using queryselector
[英]What is the difference between `document` and `document.body`?
document
和document.body
之間實際上有什么區別?
例如,我有以下代碼:
document.addEventListener('click',function(){ document.write('You click me!') })
<div>Click anywhere</div>
如果我使用document.body
而不是document
會有什么區別?
document
和document.body
之間實際上有什么區別?
我試圖在網上搜索,但找不到任何有用的信息。
感謝您的任何回復!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.