Javascript implements the iframe frame delayed loading method, javascriptiframe

Source: Internet
Author: User

Javascript implements the iframe frame delayed loading method, javascriptiframe

This article describes how to implement delayed loading of iframe framework in javascript. Share it with you for your reference. The specific implementation method is as follows:

Sometimes we want to implement delayed loading of some page items without affecting the website opening speed. Next I will introduce how to implement the iframe framework delayed loading in javascript.

HTML code of the region to be loaded:

Copy codeThe Code is as follows: <div id = "indexlogin"> </div>
Put the following code at the bottom

Copy codeThe Code is as follows: <span id = "tmpjsnews"> <script type = "text/javascript" src = "Your called js" language = "javascript"> </script> </span>
<Script type = "text/javascript"> document. getElementById ("indexlogin"). innerHTML = document. getElementById ("tmpjsnews"). innerHTML; </script>
Code 2

Copy codeThe Code is as follows: window. onload = function (){
Frames ["BiframeName"]. location. href = "B .htm ";
}
Use setTimeout

Copy codeThe Code is as follows: setTimeout (function (){
Var frame = document. createElement ('ifame ');
Frame. src = 'http://xxx.com ';
Document. getElementById ('Container'). appendChild (frame );
},60000 );

I hope this article will help you with javascript-based web programming.


How to load iframe with Javascript latency

Window. onload = function () {// setTimeout (function () {var newE = document. createElement ("iframe"); // create the iframe element newE. src = "1.jpg"; // set the new element src attribute value var crea = document. body. appendChild (newE); // Add sub-elements to the body}, 60000); // executed after 60000 milliseconds}

How can JavaScript wait for iframe loading in Chrome?

$ (Selector). load ();
What are the advantages of data extraction on the webpage?
 

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.