• JS实现多个复选框全选


    <script language="JavaScript">
    function selall1()
    {
     
    var i = 0;
     
    if(document.all("turnit1").value=="全选")
     {
      
    for(i=0;i<document.addform.elements.length;i++
      {
          
    if(document.addform.elements[i].type == "checkbox"&&(document.addform.elements[i].name=="jcss"))
          {
           document.addform.elements[i].checked
    =true;
          }
      } 
      document.all(
    "turnit1").value="清除";
     }
     
    else
     {
      
    for(i=0;i<document.addform.elements.length;i++
      {
          
    if(document.addform.elements[i].type == "checkbox"&&(document.addform.elements[i].name=="jcss"))
          {
           document.addform.elements[i].checked
    =false;
          }
      } 
      document.all(
    "turnit1").value="全选";
     }
    }
    function selall2()
    {
     
    var i = 0;
     
    if(document.all("turnit2").value=="全选")
     {
      
    for(i=0;i<document.addform.elements.length;i++
      {
          
    if(document.addform.elements[i].type == "checkbox"&&(document.addform.elements[i].name=="sbqk"))
          {
           document.addform.elements[i].checked
    =true;
          }
      } 
      document.all(
    "turnit2").value="清除";
     }
     
    else
     {
      
    for(i=0;i<document.addform.elements.length;i++
      {
          
    if(document.addform.elements[i].type == "checkbox"&&(document.addform.elements[i].name=="sbqk"))
          {
           document.addform.elements[i].checked
    =false;
          }
      } 
      document.all(
    "turnit2").value="全选";
     }
    }

    </SCRIPT>
    <TABLE cellSpacing=0 cellPadding=0 width=96% border=0>
                        
    <TBODY>
                        
    <FORM name=addform onsubmit="return checkform()" action=hezu_add_save.asp
    method=post >
    <TR> 
                                    
    <TD width=15% height="26" align=left><font color="#FF9900">·</font>基础设施: 
                                    
    </TD>
                                    
    <TD align=left colSpan=3><LABEL> 
                                      
    <input
    name=jcss type=checkbox id="jcss2" value=水电 style="margin-left:-5px">
                                      水电
    </LABEL> <LABEL> 
                                      
    <input
    name=jcss type=checkbox id="jcss2" value=煤气>
                                      煤气
    </LABEL> <LABEL> 
                                      
    <input
    name=jcss type=checkbox id="jcss2" value=暖气>
                                      暖气
    </LABEL> <LABEL> 
                                      
    <input
    name=jcss type=checkbox id="jcss2" value=厨房>
                                      厨房
    </LABEL> <LABEL> 
                                      
    <input name=jcss type=checkbox id="jcss2"
    value
    =有线>
                                      有线
    </LABEL> <LABEL> 
                                      
    <input name=jcss type=checkbox id="jcss2"
    value
    =合金窗>
                                      合金窗
    </LABEL> <LABEL> 
                                      
    <input name=jcss type=checkbox id="jcss2"
    value
    =防盗门>
                                      防盗门
    </LABEL> <INPUT id=turnit1 onclick=javascript:selall1() type=button value=全选 name=turnit1></TD>
                                  
    </TR>
    <TR> 
                                    
    <TD align=left height="26"><font color="#FF9900">·</font>配套设施: 
                                    
    </TD>
                                    
    <TD align=left colSpan=3 height="26" style="line-height:160%;padding-bottom:2px"> 
                                      
    <p> 
                                        
    <LABEL> 
                                        
    <input type=checkbox value=地板
    name=sbqk style="margin-left:-5px">
                                        地板
    </LABEL>
                                        
    <LABEL> 
                                        
    <INPUT type=checkbox value=床
    name=sbqk>
                                        床铺
    </LABEL>
                                        
    <LABEL> 
                                        
    <INPUT type=checkbox value=家具
    name=sbqk>
                                        家具
    </LABEL>
                                        
    <LABEL> 
                                        
    <input type=checkbox value=电话
    name=sbqk>
                                        电话
    </LABEL>
                                        
    <LABEL> 
                                        
    <INPUT
    type=checkbox value=电视 name=sbqk>
                                        电视
    </LABEL>
                                        
    <LABEL> 
                                        
    <input
    type=checkbox value=空调 name=sbqk>
                                        空调
    </LABEL>
                                        
    <LABEL> 
                                        
    <input
    type=checkbox value=洗衣机 name=sbqk>
                                        洗衣机
    </LABEL>
                                        
    <LABEL> 
                                        
    <input
    type=checkbox value=电冰箱 name=sbqk>
                                        冰箱
    </LABEL>
                                        
    <LABEL><br>
                                        
    <INPUT type=checkbox value=宽带 name=sbqk style="margin-left:-5px">
                                        宽带
    </LABEL>
                                        
    <LABEL> 
                                        
    <INPUT type=checkbox value=电梯 name=sbqk>
                                        电梯
    </LABEL>
                                        
    <LABEL> 
                                        
    <input type=checkbox value=车位 name=sbqk>
                                        车位
    </LABEL>
                                        
    <LABEL> </LABEL>
                                        
    <LABEL> </LABEL>
                                        
    <LABEL> 
                                        
    <input
    type=checkbox value=热水器 name=sbqk>
                                        热水器
    </LABEL>
                                        
    <INPUT
    type=checkbox value=油烟机 name=sbqk>
                                        油烟机 
                                        
    <INPUT onclick=javascript:selall2() type=button value=全选 name=turnit2>
                                      
    </p></TD>
                                  
    </TR>
    </form>
    </table>

     

    申明

    非源创博文中的内容均收集自网上,若有侵权之处,请及时联络,我会在第一时间内删除.再次说声抱歉!!!

    博文欢迎转载,但请给出原文连接。

  • 相关阅读:
    ldconfig和ldd用法
    Linux上ld和ld.so命令的区别
    一维二维码的提取、识别和产生
    最大轮廓和投影
    如何做出半透明和闪光效果
    马赫效应和应对方法
    钢管识别项目1
    钢管识别项目2
    选择轮廓(select_shape)
    压板识别项目分析
  • 原文地址:https://www.cnblogs.com/Athrun/p/1126286.html
Copyright © 2020-2023  润新知