<!DOCTYPE html>
<html><head>
<title>复仇者联盟</title>
<meta charset="utf-8">
<style type="text/css">
*,body{
padding:0;
margin:0;
}
.main{
width:600px;
height:314px;
background:#000;
}
#vo{
width:100%;
height:249px;
margin-top:30px;
background-color:black;
}
#controls{
height:30px;
width:170px;
background-color:rgba(0,0,0,0.5);
display:none;
position:relative;
left:50%;
transform:translate(-50%,-30%);
}
#controls img{
width:30px;
margin:0 15px;
}
.btn{
width:40px;
}
.main:hover #controls{
display:flex;
}
input{
padding:0 6px;
}
</style>
</head>
<body>
<div class="main">
<!--视频-->
<video id="vo" src="res/htmlLX/video/avenger1.mp4" autoplay="autoplay"></video>
<!--控制按扭-->
<div id="controls">
<input type="button" value="上一段" οnclick="last();">
<input type="button" value="下一段" οnclick="next();">
</div>
</div>
<script>
var a = 1;
//上一段
function last(){
if(a==1){
document.getElementById("vo").src="res/htmlLX/video/avenger1.mp4";
}else{
a--;
document.getElementById("vo").src="res/htmlLX/video/avenger"+a+".mp4";
}
}
//下一段
function next(){
if(a==4){
document.getElementById("vo").src="res/htmlLX/video/avenger4.mp4";
}else{
a++;
document.getElementById("vo").src="res/htmlLX/video/avenger"+a+".mp4";
}
}
</script>
</body>
</html>