다음을 통해 공유


createEventObject Method

Creates an event object that can be used to pass event context information to the PUBLIC:EVENT element's fire method.

Syntax

oEvent = element.createEventObject()

Return Value

Returns an event object.

Remarks

The same event object cannot be reused in multiple calls to the fire method.

All properties of the event object that is created using createEventObject are read/write, including those properties that would be read-only in Dynamic HTML (DHTML). You can use the HTML Component (HTC) file to set properties on the event object before firing an event.

Examples

This example is derived from a calculator behavior sample. When the result changes, the behavior fires a custom onResultChange event back to the page, passing the result as a custom property of the event object.

<PUBLIC:EVENT NAME="onResultChange" ID="rcID"  />

<SCRIPT LANGUAGE="JScript">

:
function doCalc()
{
   :
   oEvent = createEventObject();
   oEvent.result = sResult;
   rcID.fire (oEvent);
}
</SCRIPT >

This example shows what the containing page looks like.

<HTML XMLNS:InetSDK>
<HEAD>
<STYLE>
@media all {
   InetSDK\:CALC    {behavior:url(engine.htc)} 
}   
</STYLE>
</HEAD>

<InetSDK:CALC id="myCalc"
    onResultChange="resultWindow.innerText=window.event.result">
<TABLE>
<TR><DIV ID="resultWindow" STYLE="border:'.025cm solid gray'"
         ALIGN=RIGHT>0.</DIV></TR>
<TR><TD><INPUT TYPE=BUTTON VALUE=" 7 "></TD>
    <TD><INPUT TYPE=BUTTON VALUE=" 8 "></TD>
    <TD><INPUT TYPE=BUTTON VALUE=" 9 "></TD>
    <TD><INPUT TYPE=BUTTON VALUE=" / "></TD>
    <TD><INPUT TYPE=BUTTON VALUE=" C "></TD>
</TR>
    :   
</TABLE>
</InetSDK:CALC>
</HTML>

Code example: https://samples.msdn.microsoft.com/workshop/samples/components/htc/calc/calc.htm

Applies To

element

See Also

detachEvent, Introduction to DHTML Behaviors, Introduction to Viewlink, About Element Behaviors