我写了一段代码,目的是通过点击一张图片实现背景视频的声音控制,求大神指导指导啊!以下是相关代码
<script type="text/javascript">
window.onload = function(){
var Control_Sound = document.getElementById("Control_Sound");
var Sound = document.getElementsByTagName('video')[0].getAttribute('/*此处未写*/');
console.log(Sound.value);
Control_Sound.onclick = function(){
if(Sound){/*此处未写*/
}
else {/*此处未写*/
}
}
}
</script>
<style type="text/css">
body video{
position: fixed;
right: 0px;
bottom: 0px;
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
z-index: -2;
background: no-repeat;
background-size: cover;
}
</style>
<video autoplay="autoplay" loop="loop" poster="2.html" >
<source src="2017天猫双十一广告视频合集_标清.mp4" type="video/mp4">
</video>
<img src="Sound.png" id="Control_Sound">