JavaScript Reference/Javascript Methods/createEventObject

Материал из Web эксперт
Перейти к: навигация, поиск

"createEventObject()" Example

    
<html>
<body>
<script language="JavaScript">
function function1() {
    var myEvent = document.createEventObject();
    parent.document.all.myButton.fireEvent("onclick", myEvent);
    event.cancelBubble = true; 
} 
function function2() {
    alert("Hi");
}
</script>
<button onclick="function1();">Click to see alert from</button>
<button id="myButton" onclick="function2();">Click here to see alert</button>
</body>
</html>



"createEventObject()" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |document                                                      |
+----------------+--------------------------------------------------------------+



"createEventObject()" Syntax, Parameters and Note

Note:
Creates an event object, which can be passed to the fireEvent() method of any element.
    
Syntax:
    
document.createEventObject(param1)

Parameters:
    param1   Optional; the name of an existing event object to clone.