Skip to content

Instantly share code, notes, and snippets.

@linusthe3rd
Created February 15, 2011 20:26
Show Gist options
  • Select an option

  • Save linusthe3rd/828176 to your computer and use it in GitHub Desktop.

Select an option

Save linusthe3rd/828176 to your computer and use it in GitHub Desktop.
Attaching an event callback to an iFrame's onload event in IE
/**
* This code comes from JeremyMiller on the following thread:
* http://bytes.com/topic/javascript/answers/510057-iframe-ie-onload-problem#post3402334
*/
eventPush(document.getElementById('frame_id'),'load',function () {myFrameOnloadFunction();});
function eventPush(obj, event, handler) {
if (obj.addEventListener) {
obj.addEventListener(event, handler, false);
} else if (obj.attachEvent) {
obj.attachEvent('on'+event, handler);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment