function fireEvent(obj,evt) { var fireOnThis = obj; if( document.createEvent ) { var evObj = document.createEvent('MouseEvents'); evObj.initEvent( evt, true, false ); fireOnThis.dispatchEvent(evObj); } else if( document.createEventObject ) { fireOnThis.fireEvent('on'+evt); } } function initiateEventCall(id) { if(navigator.appName == 'Microsoft Internet Explorer') { document.getElementById(id).click(); } else { fireEvent(document.getElementById(id),'click'); } }
tips and tricks, examples,code snippet and links about Java, JavaScript, jquery, css, html, unix/linux, oracle, mysql, php and web designs that related to my interest
Sunday, May 31, 2009
initiate onclick event for FF and IE
sometimes there's a need to initiate an event.This perfectly works if FF doesn't work with event function such as .click().
No comments:
Post a Comment