Hi
Instead of directly placing event hanlders inside HTML tags,
I call object.attachEvent() method within page's onLoad.
Do I need to call detachEvent() in onUnload or somewhere else?
Bob Barrows - 22 Jan 2004 11:33 GMT
> Hi
> Instead of directly placing event hanlders inside HTML tags,
> I call object.attachEvent() method within page's onLoad.
> Do I need to call detachEvent() in onUnload or somewhere else?
No.
Only detach the handler if you need the element to stop using that event
handler while the page is still loaded. There would be no point at all to
detaching the handler in the onunload event: how can an object respond to an
event if the page is not loaded?
Bob Barrows

Signature
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Bob Barrows - 22 Jan 2004 11:36 GMT
> Hi
> Instead of directly placing event hanlders inside HTML tags,
> I call object.attachEvent() method within page's onLoad.
> Do I need to call detachEvent() in onUnload or somewhere else?
Oh wait! You're thinking that the object might "remember" that you attached
the handler the next time the page is loaded? No, this will not be the case.
Bob Barrows

Signature
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Tumurbaatar S. - 23 Jan 2004 04:06 GMT
Many thanks!
> > Hi
> > Instead of directly placing event hanlders inside HTML tags,
[quoted text clipped - 5 lines]
>
> Bob Barrows