MyTetra Share
Делитесь знаниями!
карты на сайте ubergru77.
Генерация события клика по кнопке (Click Event)
Время создания: 16.07.2012 16:10
Раздел: Компьютер - Программирование - Java Script - Greasymonkey
Запись: xintrea/mytetra_syncro/master/base/1342440605h8gb6vcic8/text.html на

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.59
Яндекс индекс цитирования