zoukankan      html  css  js  c++  java
  • 全选反选取消-js代码

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <script type="text/javascript">
    function selectAll(){
        var inputs=document.checkForm.interesting;
        //for(var i in inputs){
            for(var i=0;i<inputs.length;i++){
            inputs[i].checked=true;
        }
    }
    function deselectAll(){
        var inputs=document.checkForm.interesting;
        for(var i in inputs){
            inputs[i].checked=false;
        }
    }
    function reverseAll(){
        var inputs=document.checkForm.interesting;
        for(var i in inputs){
            inputs[i].checked=!inputs[i].checked;    
        }
    }
    </script>
    </head>
    <body>
    <form name="checkForm" action="#" method="get">
    兴趣爱好:<br />
    <input type="checkbox" name="interesting" value="1" />足球<br />
    <input type="checkbox" name="interesting" value="2" />篮球<br />
    <input type="checkbox" name="interesting" value="3" />羽毛球<br />
    <input type="checkbox" name="interesting" value="4" />台球<br />
    <input type="checkbox" name="interesting" value="5" />乒乓球<br />
    <input type="checkbox" name="interesting" value="6" />橄榄球<br />
    </form>
    <input type="button" value="全选" onclick="selectAll()" />
    <input type="button" value="反选" onclick="reverseAll()" />
    <input type="button" value="取消" onclick="deselectAll()" />
    
    </body>
    </html>
  • 相关阅读:
    shell命令--stat
    英文段子
    OCP读书笔记(16)
    shell命令--uptime
    OCP读书笔记(15)
    shell命令--dmesg
    OCP读书笔记(14)
    shell命令--hostname
    OCP读书笔记(13)
    shell命令--uname
  • 原文地址:https://www.cnblogs.com/yunmengxiaohe/p/3864074.html
Copyright © 2011-2022 走看看