HBCMS更多的中文手册参考:

detachEvent Method

DHTML文档教程

Unbinds the specified function from the event, so that the function stops receiving notifications when the event fires.

dhtml语法

object.detachEvent(sEvent, fpNotify)

Parameters

sEvent Required. Stringthat specifies any of the standard DHTML Events.
fpNotify Required. Pointerthat specifies the function previously set using the attachevent method.

return value

no return value.

remarks

behaviors that attach to events using the attachevent method must explicitly call the detachevent method to stop receiving notifications from the page when the ondetach event fires. behaviors that attach to events using the public:attach element automatically stop receiving notifications when the behavior detaches from the element, and thus do not need to call the detachevent method.

DHTML代码范例

This example calls the detachEvent method from an HTML Component (HTC) when the highlighting effect is removed from the page, causing the ondetach event to fire.

<PUBLIC:ATTACH EVENT="ondetach" ONEVENT="cleanup()" />
<SCRIPT LANGUAGE="JScript">
attachEvent ('onmouseover', Hilite);
attachEvent ('onmouseout', Restore);
function cleanup()
{
detachEvent ('onmouseover', Hilite);
detachEvent ('onmouseout', Restore);
}
function Hilite()
{
if (event.srcElement == element)
{
normalColor = style.color;
runtimeStyle.color  = "red";
runtimeStyle.cursor = "hand";
}
}
function Restore()
{
if (event.srcElement == element)
{
runtimeStyle.color  = normalColor;
runtimeStyle.cursor = "";
}
}
</SCRIPT>
This feature requires Microsoft® Internet Explorer 5 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

是否符合公共标准

There is no public standard that applies to this method.

Applies To

A, ACRONYM, ADDRESS, APPLET, AREA, B, BASE, BASEFONT, BGSOUND, BIG, BLOCKQUOTE, BODY, BR, BUTTON, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, COMMENT, CUSTOM, DD, DEL, DFN, DIR, DIV, DL, document, DT, EM, EMBED, FIELDSET, FONT, FORM, FRAME, FRAMESET, HEAD, hn, HR, HTML, I, IFRAME, IMG, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=hidden, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, INS, KBD, LABEL, LEGEND, LI, LINK, LISTING, MAP, MARQUEE, MENU, namespace, NOBR, OBJECT, OL, OPTION, P, PLAINTEXT, PRE, Q, S, SAMP, SCRIPT, SELECT, SMALL, SPAN, STRIKE, STRONG, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TITLE, TR, TT, U, UL, VAR, window, XMP

更多语法参考

attachevent, introduction to dhtml behaviors, using dhtml behaviors, Using HTML Components to Implement DHTML Behaviors in Script