嗨,我想在我的视频播放完后将页面重定向到另一个地址,到目前为止我一直在努力.我已经从Stack上的另一篇文章改编了下面的代码,但是没有用.
任何帮助将不胜感激.
<script src="text/javascript">
function playVideo() {
var video= document.getElementById('video');
video.play();
video.addEventListener('ended',function() {
window.location= 'http://www.google.com';
});
}
</script>
<video width="1280" height="720" autoplay id="video">
<source src="Jantex_Vid_converted.mp4" type="video/mp4" />
</video>
解决方法:
如果编写函数,则必须运行它
<script src="text/javascript">
function playVideo() {
var video= document.getElementById('video');
video.play();
video.addEventListener('ended',function() {
window.location= 'http://www.google.com';
});
}
playVideo();
</script>
<video width="1280" height="720" autoplay id="video">
<source src="Jantex_Vid_converted.mp4" type="video/mp4" />
</video>