Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts

    Onload in an iframe

    Are there any cross browser problems regarding the use of the onload event in an iframes tag?

    Thanks
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    document.getElementById('iframe_id').contentWindow.window.onload=function(){...do something...}

    The piece of code is crossbrowser AFAIK, at least for modern browsers.

    ...maybe the fact that it is safer to use the full root window in code should be a problem when dealing with frames/iframes...
    Last edited by Kor; 10-13-2005 at 06:14 PM.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Thanks Kor, just wanted to make sure that onload in an iframe tag was still a viable option.
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.

  • #4
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    I see that W3C recomadation for HTML 4.0 don't specify the onload amongst the iframe's attributes, but I guess that as, in fact, inner frames inherit all the frame's (and frameset's) attributes/methods, thus they accept onload as handler/event as well.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #5
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Kor

    I see that W3C recomendation for HTML 4.0 don't specify the onload amongst the iframe's attributes
    I had a quick look myself but did not come across anything positive so I thought I'd play it safe and simply ask the experts, just in case

    Once again thanks
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •