iframe onload in IE7/8 with Javascript

人走茶凉 提交于 2019-11-30 20:27:17
Joe

Replace:

iframe.onload = refresh

with:

iframe.attachEvent('load', refresh, false); 


To clear any confusion:
var iframe = document.getElementById('theiframe');
function refresh( ) {
  alert('foo');
}

if (iframe.attachEvent) iframe.attachEvent('onload', refresh);
else iframe.addEventListener('load', refresh, false)

You can call it from the iframe by calling parent.refresh() when you are done with a submit.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!