about <object> event binding
The html code:
- <html>
- <body>
- <div>
- <object data="a.php" ... >
- <param name="type" value="value">
- ....
- <embed ... >
- </object>
- </div>
- </body>
- </html>
I want to bind a user event to the <object> node using the following code:
$("object").bind("userevent",function(){ alert("user event");});
Somewhere I generate an event:
var e = document.createEvent("Event");
e.initEvent("userevent",true,true);
$("object")[0].dispatchEvent(e);
but the alert window didn't show up.
I replaced the event binding code with
$("object")[0].addEventListener("userevent",function(){alert('user event');},true)
then it works.
what is the problem? who can help me out?