Home  >  Article  >  Web Front-end  >  Javascript method to implement delayed loading of iframe framework_javascript skills

Javascript method to implement delayed loading of iframe framework_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:32:291360browse

The example in this article describes the method of implementing delayed loading of iframe framework in javascript. Share it with everyone for your reference. The specific implementation method is as follows:

Sometimes we hope that some things on the page can be delayed loaded, so that it does not affect the opening speed of the website. Let me introduce to you how to implement delayed loading of iframe framework in JavaScript.

Need to load regional HTML code:

Copy code The code is as follows:

Place the following code at the bottom

Copy code The code is as follows:


Code 2

Copy code The code is as follows:
window.onload = function() {
frames["BiframeName"].location.href = "B.htm";
}

Use setTimeout

Copy code The 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 be helpful to everyone’s web programming based on JavaScript.

Statement:
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