1

I'd like to click on an embedded youtube video using javascript (so the video plays automatically). I successfully simulated a click on a <div> like this:

function f(){
    alert("hello");
}

<div id="someid" onmouseup="f();">
    my text
</d>

document.getElementById("someid").onmouseup();

How can the above code be adapted to work with an embedded youtube video?

4

2 回答 2

2

Just add &autoplay=1 to the link of the video in the <embed> tag.

于 2011-12-08T20:08:24.440 回答
2

If he does what you suggest the views on the embedded video won't count. I'm pretty sure he is asking his question because he is trying to find a way to get the video to autoplay and have youtube count the views at the same time.

于 2012-02-26T00:48:50.747 回答