MyTetra Share
Делитесь знаниями!
О, смотри-ка какое хорошее место. Дайте два!
Генерация события клика по кнопке (Click Event)
Раздел: Компьютер - Программирование - Java Script - Greasymonkey

Generating a Click Event

A slightly more complex case involves a page that does not have embedded Javascript code in their page, but rather is using something like addEventListener() to notice and act upon (e.g.) clicks within the document. In this case the above examples will not work, but we can generate a click event, as if the user had clicked their mouse.

Assume that the el variable points to some element which we want to "click on":

var evt = document.createEvent("MouseEvents");

evt.initEvent("click", true, true);


MyTetra Share v.0.44
Яндекс индекс цитирования