Load javascript ads, load pages, and then load ads

Source: Internet
Author: User

How to load the page before loading the advertisement:
The order in which a webpage is opened is based on the order from top to bottom of the page. To make the advertisement do not affect the page opening speed, you must wait until all the pages are opened and then load the JS Code. When the page is loaded and then the advertisement is loaded, the JS Code of the advertisement is put at the bottom of the page. After the page content is opened, the advertisement code is loaded, use the DIV reserved on the page to output the advertisement.

Usage:
1. Place the following code on the page where you want to place the advertisement
Copy codeThe Code is as follows:
<Div id = "myads"> loading... </Div>

2. Place the code at the bottom of the page, that is, the bottom of the footer and PHP file.
Copy codeThe Code is as follows:
<Div id = "span_myads"> put the advertisement code here </div>
<Script type = "text/javascript">
Document. getElementById ("myads"). innerHTML = document. getElementById ("span_myads"). innerHTML;
Document. getElementById ("span_myads"). innerHTML = "";
</Script>

Okay, so we can load the page first and then load the advertisement. How can this problem not affect reading.

Related Article

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.