Home >Web Front-end >JS Tutorial >Some questions and answers on the use of document.write in js_javascript skills

Some questions and answers on the use of document.write in js_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:54:581082browse

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.

Copy code The code is as follows:


< ;/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.
Copy code The code is as follows:


< ;/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