<script>
function checkAll()
 { //全选,与取消
  var chkAll=document.getElementById("chk_all");
  var chkRow=document.getElementsByName("chkId");
  
  if(chkAll.checked==true)
  {
   for(var i=0;i<chkRow.length;i++)
   {
    chkRow[i].checked=true;
   }
  }
  else
  {
   for(var i=0;i<chkRow.length;i++)
   {
    chkRow[i].checked=false;
   }
  }
 } 
function do_betdel() {
  //提交
    var j=0;
  var chkRow=document.getElementsByName("chkId");
  var chkIds1="";
  for(var i=0;i<chkRow.length;i++) {
   if(chkRow[i].checked==true) {
    chkIds1+=chkRow[i].value+",";
    j=1;  
   }
  }
  if(j==1) {
   chkIds1=chkIds1.substring(0,chkIds1.length-1);document.getElementById("test").value=chkIds1;
   }}
   </script><input name="chk_all" type="checkbox" onClick="checkAll();">
 <input name="chkId" type="checkbox" value1">
 <input name="chkId" type="checkbox" value="2">