admin管理员组

文章数量:1429075

I am registering a function with the onload method of a html form, I need to unregister this event hander function on unload of the form. How do I do it in Internet Explorer 6?

I am registering a function with the onload method of a html form, I need to unregister this event hander function on unload of the form. How do I do it in Internet Explorer 6?

Share Improve this question edited Jan 13, 2009 at 11:55 Jonathan Lonowski 124k35 gold badges202 silver badges202 bronze badges asked Jan 13, 2009 at 11:43 BillamamaBillamama 1
  • Thanks, I could get it working based on Dimi's reference. Thanks for your ments too meouw. – Billamama Commented Jan 13, 2009 at 12:21
Add a ment  | 

2 Answers 2

Reset to default 7

if you have added the onload in your HTML or via JavaScript

<form onload="blah()">

or

myForm.onload = blah;

then

myForm.onload = null;

should do it
if you've used attachEvent

myForm.attachEvent( 'onload', blah );

use

myForm.detachEvent( 'onload', blah );

EDIT
I'm not sure forms have onload events tho, are you sure?

Use detachEvent

Reference

本文标签: javascriptHow to unregister an event handler in Internet Explorer 6Stack Overflow