Document.Write Coverage Issues

Source: Internet
Author: User

1. The page will not be overwritten:

If it's just a JS statement: Document.writeln (' <span id=\ ' span1\ ' > Well, Hello </span> ');

Ps:\ ' is an escape character, representing '

2. Overlay page

<! DOCTYPE html>

<meta charset= "UTF-8" >
<title>Document</title>

<body>
<p> Hello. Window.writeln</p>
<script>
Document.writeln (' <span id=\ ' span1\ ' > Well, Hello </span> ');
document.write (' 123 ');
Window.onload=function () {
Document.writeln (' <span id=\ ' span1\ ' > Well, Hello </span> ');
}
</script>
</body>

Effect:

My understanding of why it is covered:

1. Before, it is always loaded and written to the page content. When the load is finished, the document flow is closed.

2. When the load is complete, the Window.onload event is triggered. In the example, the onload binding function has: document.write (* * * *) statement, which will let the document flow open again "PS: is a method called open (), the method will empty the current document content, and then write. After writing the Close method, the document flow closed ", so there will be a cover phenomenon

  

Document.Write Coverage Issues

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.