Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #19896
| From | Tuxedo <tuxedo@mailinator.com> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Q: How to reset onload event handler that was set to null? |
| Date | 2013-05-22 22:36 +0200 |
| Organization | albasani.net |
| Message-ID | <knja7u$3mm$1@news.albasani.net> (permalink) |
Is it possible to set the onload event handler of an image object back to
its default once it has been set to null?
For example, in the beginning of a function, which was triggered by the
onload event, the onload event handler is set to null so that various image
replacements within the function body will not retrigger the function.
The onload event handler of the object is however needed again at a
different time for some other function. Eg.:
function bla(){
document.getElementById('bla').onload=null;
// some img replacement stuff that should not retrigger another onload event
document.getElementById('bla').src='another.jpg';
document.getElementById('bla').onload ...
// how to recreate the onload event handler after?
}
<img id='bla' src=some.jpg" onload="bla();">
Can the event handler be recreated after it's been set to null?
Many thanks,
Tuxedo
Back to comp.lang.javascript | Previous | Next — Next in thread | Find similar | Unroll thread
Q: How to reset onload event handler that was set to null? Tuxedo <tuxedo@mailinator.com> - 2013-05-22 22:36 +0200
Re: Q: How to reset onload event handler that was set to null? Tuxedo <tuxedo@mailinator.com> - 2013-05-22 23:32 +0200
Re: Q: How to reset onload event handler that was set to null? Tuxedo <tuxedo@mailinator.com> - 2013-05-23 00:12 +0200
Re: Q: How to reset onload event handler that was set to null? JJ <duh@nah.meh> - 2013-05-23 08:47 +0700
Re: Q: How to reset onload event handler that was set to null? Christian Winter <thepoet_nospam@arcor.de> - 2013-05-23 07:48 +0200
Re: Q: How to reset onload event handler that was set to null? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-23 10:19 +0200
Re: Q: How to reset onload event handler that was set to null? Christian Winter <thepoet_nospam@arcor.de> - 2013-05-23 18:06 +0200
Re: Q: How to reset onload event handler that was set to null? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-23 18:31 +0200
Re: Q: How to reset onload event handler that was set to null? sake mera <sakemera@gmail.com> - 2013-05-23 14:02 -0700
csiph-web