Below is the artificial event that is created to trigger an event on a dom object. e.g you may want to a click event happen on a dom object without any actual mouse click on the dom. You can do so by using 'dispatch' for firefox and fireEvent for IT
Sample DIV.
//Generate an artificial click event on "test". Fires alert("hi")
var clickevent=document.createEvent("MouseEvents")
clickevent.initEvent("click", true, true)
document.getElementById("test").dispatchEvent(myevent)
No comments:
Post a Comment