+ -
当前位置:首页 → 问答吧 → 关于iframe异步加载的问题。。。。。。

关于iframe异步加载的问题。。。。。。

时间:2011-10-07

来源:互联网

页面中嵌有框架,打开时,页面和框架并行加载吧,如何等到页面加载完毕后再加载框架呢??

参考了这个,没有结果。。
<script> (function(d) { var iframe = d.body.appendChild(d.createElement('iframe')), doc = iframe.contentWindow.document; // style the iframe with some CSS iframe.style.cssText = "position:absolute;width:200px;height:100px;left:0px;"; doc.open().write('<body onload="' + 'var d = document;d.getElementsByTagName(\'head\')[0].' + 'appendChild(d.createElement(\'script\')).src' + '=\'www.hao123.com\'">'); doc.close(); //iframe onload event happens })(document); </script>
 提示:您可以先修改部分代码再运行

作者: jgs1982   发布时间: 2011-10-07

运行代码  果然什么都没有 js错误

作者: weilanse   发布时间: 2011-10-07