<img onload= does not work in FireFox 1.0 but works in IE

Discussion in 'Javascript' started by Luke Venediger, Mar 8, 2005.

  1. Hi there,

    Please help. I cannot get a javascript function to be called from an
    img tag when the page loads. Here is a snippet of my code, and I'm
    trying to call the MM_nbGroup function, but this is not working in
    FireFox, only IE.

    My function is there (so not missing).

    <img src="Images/BTN_profile_over.jpg" name="profile" border="0"
    id="Image1" onload="MM_nbGroup('init','group1','profile','Images/BTN_profile.jpg',1)">

    Is there another way to call a function when an image loads? Please
    help! Getting desperate!

    Thanks,
    Luke Venediger.
    Luke Venediger, Mar 8, 2005
    #1
    1. Advertising

  2. Luke Venediger

    Lee Guest

    Luke Venediger said:
    >
    >Hi there,
    >
    >Please help. I cannot get a javascript function to be called from an
    >img tag when the page loads. Here is a snippet of my code, and I'm
    >trying to call the MM_nbGroup function, but this is not working in
    >FireFox, only IE.
    >
    >My function is there (so not missing).
    >
    ><img src="Images/BTN_profile_over.jpg" name="profile" border="0"
    >id="Image1"
    >onload="MM_nbGroup('init','group1','profile','Images/BTN_profile.jpg',1)">
    >
    >Is there another way to call a function when an image loads? Please
    >help! Getting desperate!


    Whatever is "not working" is in the function MM_nbGroup() or elswhere in code
    that you haven't shown us.

    The following test shows that the function is called:

    <html>
    <head>
    <script type="text/javascript">
    function MM_nbGroup(a,b,c,d,e,f) {
    alert(a+"\n"+b+"\n"+c+"\n"+d+"\n"+e+"\n"+f);
    }
    </script>
    </head>
    <body>
    <img src="Images/BTN_profile_over.jpg"
    name="profile"
    border="0"
    id="Image1"
    onload="MM_nbGroup('init','group1','profile','Images/BTN_profile.jpg',1)">
    </body>
    </html>
    Lee, Mar 8, 2005
    #2
    1. Advertising

  3. Luke Venediger

    Lee Guest

    Luke Venediger said:
    >
    >Hi,
    >
    >Thanks for the reply. Does this snippet work in FireFox?


    yes
    Lee, Mar 8, 2005
    #3
  4. Luke Venediger

    Guest

    Re: <img onload= does not work in FireFox 1.0 but works in IE

    Hi Lee,

    Thanks for the response - you are correct, this function works fine in
    IE and FireFox. Back to the drawing board.

    Cheers,
    Luke Venediger.
    , Mar 8, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    175
  2. Replies:
    4
    Views:
    137
    Dr John Stockton
    Oct 17, 2005
  3. Replies:
    2
    Views:
    92
    atetlaw
    Jun 22, 2006
  4. anne001
    Replies:
    9
    Views:
    308
    Thomas 'PointedEars' Lahn
    Dec 1, 2007
  5. Kara Johnson

    Firefox onLoad img

    Kara Johnson, Dec 3, 2007, in forum: Javascript
    Replies:
    3
    Views:
    155
    Evertjan.
    Dec 4, 2007
Loading...

Share This Page