Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #19365

Delete onload event handler initiated at img tag level?

From Tuxedo <tuxedo@mailinator.com>
Newsgroups comp.lang.javascript
Subject Delete onload event handler initiated at img tag level?
Date 2013-04-19 17:37 +0200
Organization albasani.net
Message-ID <kkroc8$26t$1@news.albasani.net> (permalink)

Show all headers | View raw


Is there a way to reliably remove an onload event that has been initiated 
at the img tag level?

For example, the following would repeat the replacement indefinitely as the 
image is replacing itself with itself:

function replace(){
document.getElementById("photo").src="pic2.jpg";
// delete onload???
}
<img src="pic1.jpg" onload="replace()" id="photo"> 

Is there way to effectively remove the event while having the onload event 
handler in the image tag as above so it only happens once?

Maybe something like:
delete document.getElementById("photo").onload; // ???

Many thanks for any advise.
Tuxedo

Back to comp.lang.javascript | Previous | NextNext in thread | Find similar


Thread

Delete onload event handler initiated at img tag level? Tuxedo <tuxedo@mailinator.com> - 2013-04-19 17:37 +0200
  Re: Delete onload event handler initiated at img tag level? Martin Honnen <mahotrash@yahoo.de> - 2013-04-19 17:50 +0200
    Re: Delete onload event handler initiated at img tag level? Tuxedo <tuxedo@mailinator.com> - 2013-04-19 21:09 +0200

csiph-web