<html>
<body onload = test()>
</body>
<script>
function test() {
var iframe = document.createElement('iframe');
iframe.id = 'testframe';
iframe.name = 'testframe';
iframe.src = 'http://www.baidu.com/';
var fn = function() { alert('iframe loaded ok'); };
if (iframe.attachEvent) {
iframe.attachEvent('onload', fn);
} else {
iframe.onload = fn;
}
document.body.insertBefore(iframe, document.body.firstChild);
}
</script>
</html>
动态创建iframe标签页并监控其加载成功(onload)的事件
猜你喜欢
转载自blog.csdn.net/i042416/article/details/104952130
今日推荐
周排行