日期:2014-05-17  浏览次数:20397 次

为什么checkbox全选不能选中,只想选中其中一列的checkbox?代码如下。
我想实现单击“步骤选择(全选)”的复选框选中选中该列的checkbox,再次单击取消全选,另外一列的checkbox不要有影响。请路过的大侠帮忙看一下。非常感谢。
JScript code
<script type="text/javascript">
     function CheckAll(form1) {
         for (var i = 0; i < form1.elements.length; i++) {
             var e = form1.element[i];
             if (e.Name == 'chk1' && e.disabled == false)
                 e.checked = form1.chkAll.checked;
         }
     }
     function unselectall() {
         if (document.myform.chkAll.checked) {
             document.myform.chkAll.checked = document.myform.chkAll.checked & 0;
         }
     }
     alert("test");   
 </script>
 


HTML code
 <table id="flowtbl" datasrc="#dso2" >
                                 <thead>
                                     <th align="left" width="152px">
                                         <input align="left" name="chkAll" type="checkbox"  onclick="CheckAll(this.form) "
                                              />
                                         步骤选择(全选)
                                     </th>
                                     <th align="left">
                                         步骤编号
                                     </th>
                                     <th align="left">
                                         步骤名称
                                     </th>
                                     <th align="left">
                                         是否审批
                                     </th>
                                 </thead>
                                 <tr>
                                     <td  class="style4">
                                         <input type="checkbox" class="chk1" value="11" />
                                     </td>
                                     <td  class="style4">
                                         <span datafld="ID"></span>
                                     </td>
                                     <td  width="312px">
                                         <span datafld="name"></span>
                                     </td>
                                     <td  >
                                         <input   type="checkbox" class="chk" /><input   type="text" />
                                     </td>
                                 </tr>
 <tr>
                                      <td  class="style4">
                                          <input type="checkbox" class="chk1" value="11" />
                                      </td>
                                      <td  class="style4">
                                          <span datafld="ID"></span>
                                      </td>
                                      <td  width="312px">
                                          <span datafld="name"></span>
                                      </td>
                                      <td  >
                                          <input   type="checkbox" class="chk" /><input   type="text" />
                                      <