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?