function iframeTimeOut(url, timeOut_callback, width, height) { ////// iframe超时处理 /// /// iframe(src路径) /// 超时后执形的操作 /// 宽 /// 高 var frm = document.createElement("iframe"); frm.width = width; frm.height = height; frm.src = url; var kill = setTimeout(timeOut_callback, 5000); //这里使用了网上的判断iframe加载完成的代码,谢谢作者。 if (frm.attachEvent) { frm.attachEvent("onload", function () { clearTimeout(kill); //这里可以执行其它操作 }); } else { frm.onload = function () { clearTimeout(kill); }; } document.body.appendChild(frm);}