简体   繁体   English

如何在Internet Explorer 6中注销事件处理程序?

[英]How to unregister an event handler 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. 我正在用html表单的onload方法注册一个函数,我需要在卸载该表单时注销此事件处理函数。 How do I do it in Internet Explorer 6? 如何在Internet Explorer 6中进行操作?

if you have added the onload in your HTML or via JavaScript 如果您已在HTML中或通过JavaScript添加了onload

<form onload="blah()">

or 要么

myForm.onload = blah;

then 然后

myForm.onload = null;

should do it 应该做
if you've used attachEvent 如果您使用过attachEvent

myForm.attachEvent( 'onload', blah );

use 采用

myForm.detachEvent( 'onload', blah );

EDIT 编辑
I'm not sure forms have onload events tho, are you sure? 我不确定表单是否有onload事件,您确定吗?

Use detachEvent 使用detachEvent

Reference 参考

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM