zoukankan      html  css  js  c++  java
  • 08 千千音乐盒实现全选和反选

    <!DOCTYPE html>
    <html>
    <head>
        <title></title>
        <style type="text/css">
            *{
                padding: 0;
                margin: 0;
            }

            #panel{
                background-color: #fff;
                border: 1px solid #ddd;
                border-radius: 4px;
                 400px;
                padding: 20px;
                margin: 100px auto;
                background-image: url('./image/skin1.jpg');
                color: red;
            }

            .panel-footer{
                text-align: center;
            }
        </style>
    </head>
    <body>
        <div id="panel">
            <div class="panpel-title">
                <h3>千千音乐盒</h3>
                <hr>
            </div>
            <div class="panel-content">
                <input type="checkbox"><a href="https://www.kugou.com/song/#hash=9C4F738916585D0039CB811AC131BFF8&album_id=560257">漂洋过海来看你</a><br>
                <input type="checkbox"><a href="https://www.kugou.com/song/#hash=E99455F42E5E6D1AC37F8346698FFC28&album_id=557277">一眼万年</a><br>
                <input type="checkbox"><a href="https://www.kugou.com/song/#hash=E99455F42E5E6D1AC37F8346698FFC28&album_id=557277">后来</a><br>
                <input type="checkbox"><a href="https://www.kugou.com/song/#hash=1AD3D0E7ABB3261A28977E57F59BB1E1&album_id=962530">没那么简单</a><br>
                <input type="checkbox"><a href="https://www.kugou.com/song/#hash=1AD3D0E7ABB3261A28977E57F59BB1E1&album_id=962530">如果你要离去</a><br>
            </div>
            <div class="panel-footer">
                <hr>
                <button id="allSelect">全选</button>
                <button id="cancleSelect">取消选中</button>
                <button id="reverseSelect">反选</button>
            </div>
        </div>

        <script type="text/javascript">
            //1.获取事件源
            function $(id){
                return typeof id === 'string' ? document.getElementById(id):null;
            }

            var inputs = document.getElementsByTagName('input');

            console.log($('allSelect'))
            //2.全选
            $('allSelect').onclick = function(){
                for(var i = 0;i < inputs.length;i++){
                    inputs[i].checked = true;
                }
            }

            //3.取消选中
            $('cancleSelect').onclick = function(){
                for(var i = 0;i < inputs.length;i++){
                    inputs[i].checked = false;
                }
            }

            //4.反选
            $('reverseSelect').onclick = function(){
                for(var i = 0;i < inputs.length;i++){
                    inputs[i].checked = !inputs[i].checked;

                    // if(inputs[i].checked){
                    //  inputs[i].checked = false;
                    // }else{inputs[i].checked=true}
                }
            }
        </script>
    </body>
    </html>
  • 相关阅读:
    calc属性
    transform,transtion属性
    cursor:属性
    html页面禁止用户右键粘贴复制保存的代码
    git 删除与撤回
    git 仓库原理
    git 创建本地仓库
    git提示错误关于错误:ssh: Could not resolve hostname github.com: Name or service not known.fatal: Could not read from remote repository.
    AttributeError: module 'socket' has no attribute 'SO_REUSEPORT'
    python paramiko模块sftp异常:paramiko.ssh_exception.SSHException: EOF during negotiation
  • 原文地址:https://www.cnblogs.com/wuhui1222/p/14179221.html
Copyright © 2011-2022 走看看