Click to Rate and Give Feedback
MSDN
MSDN Library
Web Development
HTML and CSS
Methods
 createEventObject Method

  Switch on low bandwidth view
createEventObject Method

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

Syntax

oNewEvent = object.createEventObject( [oExistingEvent])

Parameters

oExistingEvent Optional. A object that specifies an existing event object on which to base the new object.

Return Value

Returns an event object.

Example

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>

Standards Information

There is no public standard that applies to this method.

Applies To

document, HTCBehavior Constructor, HTMLDocument Constructor
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
document.createEvent      FNC   |   Edit   |   Show History
How much time will it take, up to Microsoft release a w3c capable Method or at least a implementation of Custom Events.

Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker