删除选中的多行?
<script   language= "javascript ">  
    function   delRow(){ 
          var   oc=document.getElementById( "dgPro ").getElementsByTagName( "input "); 
          var   a=0; 
          for   (i=0;i <oc.length;i++){ 
                if   ((oc(i).type)== "checkbox "){    
                         if   (oc(i).checked==true){ 
                                     dgPro.deleteRow(i+1-a); 
                                     a=a+1; 
                            } 
                      } 
          } 
    } 
  </script>  
 我通过以上方法,为何不能把复选框所选中的行都删除了呢。除第一行外每行都有一个复选框的。
------解决方案--------------------删除的时候从大向小删除,这样容易理解点
------解决方案--------------------要反过来循环,从后往前删
------解决方案--------------------LZ 的代码漏洞不少,但基本思路是对的,写了一小段!   
 下午最后一贴,干活去了!   
 L@_@K     
   <body>  
  <table id= "dgPro ">  
      <tr>  
          <td>  </td>  
          <td> Header1 </td>  
          <td> Header2 </td>  
          <td> Header3 </td>  
      </tr>  
      <tr>  
          <td>  <input type= "checkbox " />  </td>  
          <td>  <input type= "text " id= "txt11 " value= "11 " />  </td>  
          <td> 12 </td>  
          <td> 13 </td>  
      </tr>  
      <tr>  
          <td>  <input type= "checkbox " />  </td>  
          <td> 21 </td>  
          <td>  <input type= "text " id= "txt22 " value= "22 " />  </td>  
          <td> 23 </td>  
      </tr>  
      <tr>  
          <td>  <input type= "checkbox " />  </td>  
          <td> 31 </td>  
          <td> 32 </td>  
          <td>  <input type= "text " id= "txt33 " value= "33 " />  </td>  
      </tr>  
  </table>  
  <input type= "button " id= "btnDel " value= "Remove selected rows " />  
  <script type= "text/javascript ">  
    <!--   
  function delRow(){ 
    var oc=document.getElementById( "dgPro ").getElementsByTagName( "input "); 
    var a=0; 
    var rowIndex = -1;      
    for (var i=oc.length-1; i> =0; i--) 
    { 
      if (oc[i].type== "checkbox ") 
      {  
         if (oc[i].checked) 
         { 
             rowIndex = getRowIndex(oc[i]); 
             if (rowIndex != -1) 
             { 
                 dgPro.deleteRow(rowIndex); 
             } 
         } 
      } 
    } 
  } 
 function getRowIndex(oElement) 
 { 
     var rowIndex = -1; 
     while (oElement.tagName.toLowerCase() !=  "tr " && oElement.tagName.toLowerCase() !=  "body ") 
     { 
         oElement = oElement.parentNode; 
     }   
     if (oElement.tagName.toLowerCase() !=  "body ") 
     { 
         rowIndex =