zoukankan      html  css  js  c++  java
  • 全选

    <!DOCTYPE HTML>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>全选 </title>
    </head>
    
    <body>
    <script>
        document.write("<ul>");
            for(var i=0;i<10;i++){
                document.write("<li>");
                document.write('<input type="checkbox" name="ids[]" value="'+i+'">aaaaa');
                document.write("</li>")
                }
        document.write("</ul>")
    
    </script>
        <label for="aa">
        <input type="checkbox" onClick="sall(this)"></label>
            全选
        </label>
        <script>
            var names=document.getElementsByName("ids[]");
            function sall(obj){
                for(var i=0;i<names.length;i++){
                        names[i].checked=obj.checked;
                }
            }
        </script>
    </body>
    </html>
  • 相关阅读:
    Linux Netcat命令
    clang-format
    keytool
    ip
    Linux iptables
    Linux yum源完全配置
    Makefile
    CMake
    HSTS
    开源镜像
  • 原文地址:https://www.cnblogs.com/jinsuo/p/6093209.html
Copyright © 2011-2022 走看看