Javascript implements the method of delayed loading of iframe frame
- 2020-03-30 04:12:55
- OfStack
This article illustrates an example of how javascript can implement delayed loading of iframe frames. Share with you for your reference. The specific implementation method is as follows:
Need to load zone HTML code:
<div id="indexlogin"></div>
The following code is at the bottom
<span id="tmpjsnews"><script type="text/javascript" src=" You call the js" language="javascript"></script></span>
<script type="text/javascript">document.getElementById("indexlogin").innerHTML=document.getElementById("tmpjsnews").innerHTML;</script>
Code 2
window.onload = function() {
frames["BiframeName"].location.href = "B.htm";
}
Using setTimeout
setTimeout(function(){
var frame = document.createElement('IFAME');
frame.src = ' http://xxx.com';
document.getElementById('container').appendChild(frame);
}, 60000);