124697
124697

Reputation: 21893

How can I click a flash object with javascript?

I want to click the video on this page http://37.128.191.200/?640 using JavaScript but can't figure out how

document.getElementById('container').click()

does not work

Upvotes: 0

Views: 185

Answers (3)

Oswaldo Acauan
Oswaldo Acauan

Reputation: 2740

You can use your JwPlayer object.

jwplayer('container').play()

Upvotes: 2

Esailija
Esailija

Reputation: 140210

Since manually clicking that video will make it play the video, I am guessing you want to do that.

You can run this on the page to do that:

jwplayer().play()

Upvotes: 2

Grace Huang
Grace Huang

Reputation: 5679

use element.dispatchEvent instead. So your code could be:

var evt = document.createEvent("MouseEvents");
evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);

document.getElementById('container').dispatchEvent(evt)

See more details in https://developer.mozilla.org/en/DOM/element.dispatchEvent

Upvotes: 1

Related Questions