zoukankan      html  css  js  c++  java
  • 一个全选按钮js的案例

    <html>
    <head>
    <script type="text/javascript">   
     
        // 全选按钮选中标志  
        var checkflag = "false";  
        // 全选功能  
        function selectAll(name){  
            var field = document.getElementsByName(name);  
            // 如果全选按钮状态是未选中  
            if (checkflag == "false"){  
                for (i = 0; i < field.length; i++){  
                    field[i].checked = true;  
                }  
                // 更改全选按钮选中标志  
                checkflag = "true";  
            }else{  
                for (i = 0; i < field.length; i++){  
                    field[i].checked = false;   
                }  
                // 更改全选按钮选中标志  
                checkflag = "false";  
            }  
        }  
     
    </script> 
    </head>
    <body>
    <form name="form" method="post" action=""> 
        <table> 
            <tr> 
                <td> 
                    <input type="checkbox" value="全选" onClick="selectAll('list')">选中所有显示记录   
                </td> 
            </tr> 
            <tr> 
                <td> 
                    <input type="checkbox" name="list" value="1" > 
                </td>       
            </tr> 
            <tr> 
                <td> 
                    <input type="checkbox" name="list" value="2"> 
                </td>       
            </tr> 
            <tr> 
                <td> 
                   <input type="checkbox" name="list" value="3"> 
                </td>       
            </tr> 
        </table> 

    </form> 
    </body>
    </html>

  • 相关阅读:
    Ubuntu Windows双系统时差8小时问题解决
    linux无线网络配置
    Ubuntu 10.04上腾达W541U V2.0 无线网卡驱动的使用
    有些歌,放在这慢慢听
    [推荐]什么是程序员的优秀品质?
    如何阅读源代码
    Ubuntu中的有线、无线网络连接管理器──Wicd[译]
    linux下无线网卡解决方案之Ndiswrapper终极使用指南
    将jar文件做成exe可运行文件
    WOW裁缝1375详细攻略
  • 原文地址:https://www.cnblogs.com/quanfu2326/p/4302748.html
Copyright © 2011-2022 走看看