I am a newbie, so I recorded it. This answer was seen on Baidu, so it is considered a reprint.
The following content explains why if document.write is called after the page is loaded, the entire document will be overwritten.
The [HTML output] in the prompt refers to when the page is loaded.
< ;/head>
When the page is loaded, you will see Hello on the page. View the source file which is the code above.
---------------------
But if the page has been loaded, use document.write again, That will cover the entire document.
< ;/head>
Because the mouse action is executed after the page is loaded, the entire page will be covered by
Javascript. Viewing the source file now will only see
Javascript.
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn