我是一個編碼新手,但我正在嘗試爲我正在處理的項目組合一些東西。當視頻結束時重定向到隨機網頁
我想要的是網頁加載,播放視頻,然後當視頻結束,然後重定向到7個可能的頁面之一。
目前我有兩個單獨的代碼位用於這兩個函數。
對於視頻負載/播放/重定向(目前其重定向到谷歌)我有這樣的:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="http://vjs.zencdn.net/c/video-js.css" rel="stylesheet">
<script src="http://vjs.zencdn.net/c/video.js"></script>
<!----<META HTTP-EQUIV="refresh" CONTENT="50;URL=http://www.flashybee.com/gaf/test">-->
<title>Untitled Document</title>
</head>
<body bgcolor="#000000">
<div align="center">
<video id="index_vid" class="video-js vjs-default-skin" controls autoplay preload="auto" width="800" height="400" data-setup="{}">
<source src="index_vid.mp4" type='video/mp4'>
<source src="index_vid.webm" type='video/webm'>
</video>
<script type="text/javascript">
_V_("index_vid").ready(function(){
var myPlayer = this;
myPlayer.play();
myPlayer.addEvent("ended", function(){
window.location = "http://www.google.com"
});
});
</script>
</div>
</body>
</html>
對於隨機鏈接我有以下幾點:
<script type="text/javascript">
function randomlinks(){
var myrandom=Math.round(Math.random()*6)
var links=new Array()
links[0]="test1.html"
links[1]="test2.html"
links[2]="test3.html"
links[3]="test4.html"
links[4]="test5.html"
links[5]="test10.html"
links[6]="test11.html"
window.location=links[myrandom]
}
</script>
<form>
<input name="butt" type="button" id="butt" onClick="randomlinks()" value="random link!">
</form>
我不能解決如何解決這些問題,以獲得我所需要的。我想要視頻的結尾來觸發隨機鏈接並打開它。
任何幫助將不勝感激。
謝謝!
[Random array redirect from array](http://stackoverflow.com/questions/20100450/random-url-redirect-from-array) – BillyBigPotatoes