Home > Web Front-end > JS Tutorial > JS: executing document.write after the document has finished loading, the entire HTML page will be overwritten

JS: executing document.write after the document has finished loading, the entire HTML page will be overwritten

怪我咯
Release: 2017-06-27 11:42:07
Original
2653 people have browsed it

My personal understanding is that when an event containing document.write() is triggered, the elements in the body of the HTML page will disappear and the content in document.write() will be displayed. For example, the following code:

 <p>我的第一个段落</p>
<button onclick="changeP()">点击<button>
 function changeP(){
    docume
Copy after login

After clicking OK, the content in the label p and button disappears, and the current date is displayed on the page.

The above is the detailed content of JS: executing document.write after the document has finished loading, the entire HTML page will be overwritten. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template