最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

attachEvent Method

Internet Development Index

Binds the specified function to an event, so that the function gets called whenever the event fires on the object.

Syntax

bSuccess = object.attachEvent(sEvent, fpNotify)

Parameters

sEvent Required. String爐hat specifies any of the standard DHTML Events.
fpNotify Required. Pointer that specifies爐he function to call when sEvent fires.

Return Value

Boolean. Returns one of the following possible values:

trueThe function was bound successfully to the event.
falseThe function was not bound to the event.

Remarks

When sEvent fires on the object, the object's sEvent handler is called before fpNotify , the specified function. If you attach multiple functions to the same event on the same object, the functions are called in random order, immediately after the object's event handler is called.

The attachEvent method enables a behavior to handle events that occur on the containing page. This method is not limited, however, to behaviors. You can also define a function on a page that attaches to events fired on the same page.

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.

A behavior that attaches to events on the page using the HTML Component (HTC)?A HREF="/workshop/components/htc/reference/elements/attach.html">PUBLIC:ATTACH element automatically stops receiving notifications when the behavior detaches from the element, and does not need to call the detachEvent method.

Note  To use the attachEvent method with Microsoft® Visual Basic® Scripting Edition (VBScript), you need to use the GetRef to obtain a function pointer. The function pointer can then be passed to attachEvent.

Examples

This example shows how to implement a mouseover highlighting effect by calling the attachEvent method from an HTC.

<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.

The following example shows how to use the attachEvent method with VBScript. When you click on the span's text, the event handler changes the background color.

<HTML>
<BODY ONLOAD="setupEventHandler()" LANGUAGE="VBS">
<SCRIPT LANGUAGE="VBS">
function setupEventHandler()
set fpchgBackground = getRef("chgBackground")
call mySpan.attachEvent("onclick", fpChgBackground)
end function
function chgBackground()
document.bgColor = "lemonchiffon"
end function
</SCRIPT>
<SPAN ID="mySpan">SPAN</SPAN>
</BODY>
</HTML>

Standards Information

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

See Also

detachEvent, Introduction to DHTML Behaviors, Using DHTML Behaviors, Using HTML Components to Implement DHTML Behaviors in Script
股票| 前郭尔| 渭源县| 阿荣旗| 布拖县| 阿拉善右旗| 丰都县| 锡林郭勒盟| 神木县| 阜平县| 杨浦区| 肥东县| 昭平县| 武宣县| 宜宾县| 普定县| 温宿县| 广南县| 罗平县| 隆昌县| 延边| 拉孜县| 庄浪县| 墨脱县| 荔波县| 施甸县| 宁远县| 井冈山市| 红安县| 颍上县| 若羌县| 贵港市| 永定县| 卓资县| 格尔木市| 佛山市| 桦甸市| 澄城县| 仙游县| 买车| 新乡县|