您的位置:首页 > 其它

视屏暂停的时候添加广告

2016-05-24 19:28 211 查看
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Document</title>
<style type="text/css">
div{
width: 1000px;
height: 500px;
position: relative;
}
p{
width: 100px;
height: 100px;
background: red;
position: absolute;
top:50%;
left:50%;
display: none;
}
video{
position: absolute;
top:0;
left:0;
}
</style>
<script type="text/javascript">
<span style="font-size:18px;"> <strong> window.onload= function(){
var video = document.getElementsByTagName("video")[0];
var p = document.getElementsByTagName("p")[0];
video.onpause = function(){
p.style.display = "block"
}
video.onplay = function(){
p.style.display = "none"
}
}</strong></span>
</script>
</head>
<body>
<div>
<<strong>video</strong> src="video/movie.mp4" <strong>autoplay</strong> controls width="1000" height="500"></video>
<<strong>p</strong>>我是广告</p>
</div>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: