[英]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 我想使用JavaScript单击此页面
http://37.128.191.200/?640
上的视频,但不知道如何
document.getElementById('container').click()
does not work 不起作用
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()
您可以使用JwPlayer对象。
jwplayer('container').play()
use element.dispatchEvent
instead. 请改用
element.dispatchEvent
。 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 在https://developer.mozilla.org/en/DOM/element.dispatchEvent中查看更多详细信息
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.