Home | Top | Free Ajax Editor | JavaScript Editor | Get Advanced JavaScript and Ajax Editor, Validator and Debugger! 1st JavaScript Editor. |
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 that specifies any of the standard DHTML Events . |
fpNotify | Required. Pointer that specifies the function to call when sEvent fires. |
Return Value
Boolean . Returns one of the following possible values:
true | The function was bound successfully to the event. |
false | The 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) 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 .
Home | Top | Free Ajax Editor | JavaScript Editor | Get Advanced JavaScript and Ajax Editor, Validator and Debugger! 1st JavaScript Editor. |