首页 > 代码库 > javascript 网页图标音乐切换
javascript 网页图标音乐切换
图片名称 sprite.zip
<!doctype html><html> <head> </head><style> .css{ position: absolute; top: 0; left: 0; height: 100%; width: 100%; z-index: -10; background-position: center 0; background-repeat: no-repeat; background-attachment: fixed; background-size: cover; -webkit-background-size: cover; -o-background-size: cover; zoom: 1; background-image: url("117.jpg"); } #video1{ display:none; } #play{ width: 60px; height: 61px; background:url(sprite.png) no-repeat; background-position: -60px 0px; border:none; } #vid{ width: 60px; height: 61px; background:url(sprite.png) no-repeat; background-position: 0 0; border:none; } .hide{ display:none; }</style> <body> <div class="css"> </div> <audio src=http://www.mamicode.com/"1.mp3" controls="controls" id="video1"> 不支持 </audio> <button type="button" id="play" onclick="playVid()"></button> <button class="hide" type="button" id="vid" onclick="pauseVid()"></button> </body><script>var myVideo=document.getElementById("video1");var Oplay = document.getElementById(‘play‘);var Ovid = document.getElementById(‘vid‘);Oplay.onclick=function(){ this.style.display=‘none‘; Ovid.style.display=‘block‘; myVideo.play();}Ovid.onclick=function(){ this.style.display=‘none‘; Oplay.style.display=‘block‘; myVideo.pause();}/**function playVid() { myVideo.play(); }function pauseVid() { myVideo.pause(); } */</script></html>
javascript 网页图标音乐切换
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。