我在另一个视频上有一个视频。现在它的工作原理是,第一个视频在 20 秒后关闭,用户将被发送到第二个视频,但我希望当用户点击第一个视频的播放时,计时器将停止并且不会在 20 秒后关闭第一个视频秒。我该怎么办?
这是我的代码
<div id="luong_video_ads">
<div id="luong_video_ads_mes">
<div style="float:left;">
<p style="color: #565656; font-family: sans-serif; font-size: 13px;">Ad will be closed in <span id="luong_video_ads_c"></span> seconds
</p>
</div>
<div style="float:left;margin-left:30px;">
<input type="button" style="background: #ffe100; color: #474747; float: right; border: 1px solid #474747; border-radius: 5px; "value="Skip Ad" onclick="luong_video_ads_showMainVideo();">
</div>
</div>
<br style="clear:both;"/>
<div id="luong_video_ads_player">
</div>
</div>
<script type="text/javascript">
luong_video_ads_time_wait = 30;
luong_video_ads_showed = 0;
luong_video_ads_embed = '<iframe src="http://player.vimeo.com/video/17618255" width="500" height="281" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
luong_video_ads_main_embed = '<object width="420" height="315"><param name="movie" value="http://www.youtube.com/v/Fcx-bRni7WM? version=3&hl=en_US&rel=0&autoplay=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/Fcx-bRni7WM?version=3&hl=en_US&rel=0&autoplay=1" type="application/x-shockwave-flash" width="420" height="315" allowscriptaccess="always" allowfullscreen="true"></embed></object>';
function luong_video_ads_showAdsVideo(){
document.getElementById("luong_video_ads_c").innerHTML = luong_video_ads_time_wait;
document.getElementById("luong_video_ads_player").innerHTML = luong_video_ads_embed;
}
function luong_video_ads_showMainVideo(){
if (luong_video_ads_showed>0)
return;
luong_video_ads_showed = 1;
document.getElementById("luong_video_ads_player").innerHTML = luong_video_ads_main_embed;
document.getElementById("luong_video_ads_mes").style.display = 'none';
}
luong_video_ads_int=self.setInterval(function(){luong_video_ads_clock()},1000);
function luong_video_ads_clock(){
luong_video_ads_time_wait--;
if (luong_video_ads_time_wait==0){
luong_video_ads_showMainVideo();
}
document.getElementById("luong_video_ads_c").innerHTML = luong_video_ads_time_wait;
}
luong_video_ads_showAdsVideo();
</script>
提前感谢