0
我有一个iframe,但是当你没有互联网连接,它应该去 error.html。错误的iframe转到其他网站?
我的代码有什么问题?
<script>
function errorsrc() {
document.getElementById['frame'].src = "error.html";
}
</script>
<iframe id="frame" frameborder="0" src="http://www.google.com/" onerror="errorsrc()" ></iframe>
谢谢。
即使网址无法加载onerror事件将不会触发。看到类似的问题http://stackoverflow.com/questions/3646079/how-to-check-if-iframe-fails-to-load-jquery – 2013-04-28 08:46:09
当没有互联网连接,你怎么去error.html? – 2013-04-28 09:59:07
@KhanhTo error.html处于脱机状态 – eds1999 2013-04-28 13:29:51