3 out of 6 rated this helpful - Rate this topic

createEventObject method

[This documentation is preliminary and is subject to change.]

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

Syntax

var ppEventObj = document.createEventObject(pvarEventObject);

Standards information

There are no standards that apply here.

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: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Type: IHTMLEventObjReturns an event object.A pointer to an IHTMLEventObj interface that receives the event object that is created.

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>


 

 

Build date: 3/14/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
when oh when

I think that it should take exactly as long as it took w3c to become aware that this sort of functionality should exist, and few more to come up with a syntax that will break the compatibility of its inventor.

It is w3c the who should follow the syntax of the inventor, not the other way around!

How long to implement W3C methods ?
Yes, how long?
Half of my javascript lines are because IE !
document.createEvent
How much time will it take, up to Microsoft release a w3c capable Method or at least a implementation of Custom Events.

  • 2/17/2009
  • FNC
  • 2/17/2009
  • FNC