用js控制video的src_百度知道

代码如下 <section id="player"> <video id="media" width="100%" height="100%" controls> <source id="v1" src="video/1.mp4"> </video> </section> <div class="container" width="100%" style="margin-top:20px"> <bu...展开
//js部分
window.onload=function(){
    document.getElementById("u1").onclick=function(){
        document.getElementById("v1").src="video/1.mp4";
        document.getElementById("media").load();
    }
    document.getElementById("u2").onclick=function(){
        document.getElementById("v1").src="video/2.mp4";
        document.getElementById("media").load();
    }
    document.getElementById("u3").onclick=function(){
        document.getElementById("v1").src="video/3.mp4";
        document.getElementById("media").load();
    }
    document.getElementById("u4").onclick=function(){
        document.getElementById("v1").src="video/4.mp4";
        document.getElementById("media").load();
    }
}
posted @ 2018-10-31 16:18  猿来你也在这里呀  阅读(1830)  评论(0编辑  收藏  举报