视频

来源:互联网 发布:人工智能 书籍 知乎 编辑:程序博客网 时间:2024/04/27 14:37
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <style type="text/css">
          .bg {position: relative; float: left;}
          .fd_gif {position: absolute;z-index:99;top:0;left:0;margin-left: 120px; margin-top: 60px;}
          input{
              width: 60px;
              height: 30px;
          }
        </style>
        <script type="text/javascript">
            function bofang(v){
                var id = v.nextSibling;
                while(id.nodeType!=1){
                    id=id.nextSibling;
                }
                
                id.style.display = "block";
            }
            function bofang1(v){
                var id = v.parentNode;
                id.style.display = "block";
            }
            function huachu(v){
                
                var id = v.nextSibling;
                while(id.nodeType!=1){
                    id=id.nextSibling;
                }
                
                console.log(id);
                id.style.display = "none";
            }
            function dianji(mdiv){
                if (mdiv.value == "播放"){
                    var v = mdiv.parentNode.previousSibling;
                    while(v.nodeType!=1){
                        v=v.previousSibling;
                    }
                    v.play();
                    mdiv.value = "暂停";
                }else{
                    var v = mdiv.parentNode.previousSibling;
                    while(v.nodeType!=1){
                        v=v.previousSibling;
                    }
                    v.pause();
                    mdiv.value = "播放";
                }
            }
        </script>
    </head>
    <body>
        <div>
            <div class="bg">
              <video width="300" loop="loop" onmouseover="bofang(this)" onmouseleave="huachu(this)">
                <source src="img/movie.mp4"/>
              </video>
              <div class="fd_gif" style="display: none;">
                  <input type="button" value="播放" onclick="dianji(this)" onmouseover="bofang1(this)" />
              </div>
            </div>
            
            <div class="bg">
              <video width="300" loop="loop" onmouseover="bofang(this)" onmouseleave="huachu(this)">
                <source src="img/movie.mp4"/>
              </video>
              <div class="fd_gif" style="display: none;">
                  <input type="button" value="播放" onclick="dianji(this)" onmouseover="bofang1(this)" />
              </div>
            </div>
            
            <div class="bg">
              <video width="300" loop="loop" onmouseover="bofang(this)" onmouseleave="huachu(this)">
                <source src="img/movie.mp4"/>
              </video>
              <div class="fd_gif" style="display: none;">
                  <input type="button" value="播放" onclick="dianji(this)" onmouseover="bofang1(this)" />
             </div>
        </div>
    </body>
</html>
原创粉丝点击