EN
이 콘텐츠는 한국어로 제공되지 않아 영어 버전으로 표시됩니다.

createEventObject method

Generates an event object to pass event context information when you use the fireEvent method.

Syntax

var ppEventObj = document.createEventObject(pvarEventObject);

Parameters

pvarEventObject [in, optional]
C++A pointer to a Variant that specifies an existing event object on which to base the new object. Set pvarEventObject to null to specify a new, blank event object.
JavaScriptAn object that specifies an existing event object on which to base the new object.
ppEventObj [out, retval]
C++A pointer to an IHTMLEventObj interface that receives the event object that is created.
JavaScriptReturns an event object.

Return value

Type: IHTMLEventObj

Returns an event object.A pointer to an IHTMLEventObj interface that receives the event object that is created.

Standards information

There are no standards that apply here.

Examples

The following sample shows how to use the createEventObject method with the fireEvent method.


<html>
<body>
<script>
function OuterClick() {
    if(event.expando == "from_inner")
    {
        alert("Event actually fired by clicking on inner DIV!")
    }
    else
    {
        alert("Event fired by clicking on outer DIV!")
    }
}
function InnerClick() {
    var eventObj = document.createEventObject();
    // Set an expando property on the event object. This will be used by the 
    // event handler to determine what element was clicked on.
    eventObj.expando = "from_inner";
    parent.document.all.Outer.fireEvent("onclick",eventObj);
    event.cancelBubble = true;
}
</script>
<div id="Outer" onclick="OuterClick()" style="height:200;width:200;padding:50;background-color:mistyrose">
<div id="Inner" onclick="InnerClick()" style="height:100;width:100;padding:25;background-color:lavender"></div>
</div>
</body>
</html>


See also

document

 

 

표시:
© 2014 Microsoft. All rights reserved.