Multiple onLoad in Opera

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Krzysiek S.

    Multiple onLoad in Opera

    Hi, I need your help.

    How to get multiple onLoad in Opera (v.7)?
    Example shows what I mean - it works well IE and Mozilla, but not in
    Opera :(
    (click an image):

    <IMG src="http://info.onet.pl/_i/galeria/okulary/15.jpg"
    onload="var xx=document.get ElementById('xx x');
    xx.innerHTML+=' <BR>LOADED'"
    onclick="this.s rc='http://info.onet.pl/_i/galeria/okulary/17.jpg'">
    <DIV id=xxx>--</DIV>

    Is there anything similar to "stateChang e" ?

    Thanx 4 answers.
    --
    Krzysiek Studzinski

  • Martin Honnen

    #2
    Re: Multiple onLoad in Opera



    Krzysiek S. wrote:

    [color=blue]
    > Example shows what I mean - it works well IE and Mozilla, but not in
    > Opera :(
    > (click an image):
    >
    > <IMG src="http://info.onet.pl/_i/galeria/okulary/15.jpg"
    > onload="var xx=document.get ElementById('xx x');
    > xx.innerHTML+=' <BR>LOADED'"
    > onclick="this.s rc='http://info.onet.pl/_i/galeria/okulary/17.jpg'">
    > <DIV id=xxx>--</DIV>[/color]

    I think that is a bug in Opera, you might want to file that, visit
    http://www.opera.com/support/bugs/.

    I don't see a simple workaround, I have tried to add an event listener
    with addEventListene r but that doesn't fire either if the src is changed.

    What you could try is replacing the <img> element with a new one e.g.

    function replaceImage (img, newURL) {
    if (img.cloneNode) {
    var newImg = img.cloneNode(f alse);
    newImg.src = newURL;
    img.parentNode. replaceChild(ne wImg, img);
    }
    }

    <img id="image2"
    alt="load test"
    onload="alert(e vent.type);"
    src="buttonOff. gif"
    onclick="replac eImage(this, 'buttonOn.gif') ;">


    --

    Martin Honnen


    Comment

    Working...