用JS写的单击事件,点击超链接跳出播放视频的小弹窗,但是在点击超链接的时候不起作用,不知道什么原因小窗口弹不出来,代码贴在下面有回的兄弟看看是什么原因。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
a{
text-decoration: none;
}
*{
margin: 0;
padding: 0;
}
.tan{
margin:200px auto;
width:600px;
height: 400px;
background-color: #ff6700;
position: relative;
display: none;
}
.video{
width:100%;
height: 400px;
}
.cha{
width: 20px;
height: 21px;
padding-left: 7px;
background-color: dodgerblue;
position: absolute;
right: 1px;
top: 1px;
}
</style>
</head>
<body>
<div>
<a class="dianJi" href="javascript:;">点击查看视频
</a>
</div>
<div class="tan">
<video class="video"></video>
<div class="cha">
<a class="aa" href="#">X</a>
</div>
</div>
<script>
var dianJi = document.getElementById('dianJi');
var tan = document.getElementById('tan');
var video = document.getElementById('video');
/*var cha = document.getElementById('cha');*/
var aa = document.getElementById('aa');
dianJi.onclick=function () {
tan.style.display='block';
video.innerHTML='<video src="vid/turandeziwo.mkv" poster="" oncontextmenu="return false"></video>';
}
aa.onclick= function () {
tan.style.display='none';
}
</script>
</body>
</html>