| <html> |
| <head> |
| <script> |
| |
| var handler = new Object; |
| handler.handleEvent = function (event) { |
| document.getElementById("console").appendChild(document.createTextNode("Received event: " + event)); |
| } |
| |
| function test() { |
| if (window.testRunner) |
| testRunner.dumpAsText(); |
| |
| document.addEventListener("event", handler, false); |
| var event = document.createEvent("Event"); |
| event.initEvent("event", true, true); |
| document.dispatchEvent(event); |
| } |
| |
| </script> |
| |
| <body onload="test()"> |
| <p>This test creates and sends an event to a handler that's implemented with a handleEvent function. |
| If the test succeeds, there will be text below saying "Received event".</p> |
| <div id="console"></div> |
| </body> |
| </html> |