Created
February 15, 2011 20:26
-
-
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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * 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