Revision: 20533
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 18, 2009 06:24 by ginoplusio
Initial Code
HTMLElement.prototype.click = function() { if (document.createEvent) { var evt = this.ownerDocument.createEvent('MouseEvents'); evt.initMouseEvent('click', true, true, this.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0, null); this.dispatchEvent(evt); } else if (this.fireEvent) { this.fireEvent("onclick"); } } // usage // <a href="http://www.barattalo.it" id="linktoclick">auto click</a> document.getElementById("linktoclick").click();
Initial URL
http://www.barattalo.it/2009/11/18/click-links-with-javascript/
Initial Description
Let you fire click events on any html element.
Initial Title
How do I click a link with javascript?
Initial Tags
javascript, event
Initial Language
JavaScript