得到checkbox中的流水号,并把它存入hidden中或者Textbox中(分页中checkbox的选择与消选)

cs中:hickb.Attributes["onchange"] = "javascript:GetSnToHidden(this.id);" ;

function GetSnToHidden(textid)

{

 var checkbox=document.getElementById(textid);

var hdsn=document.getElementById('txtgooodssn');

var ifcheckedsn=checkbox.value+"," alert(ifcheckedsn);

if(checkbox.checked==true)

 {

   hdsn.value+=checkbox.value+","

}

else

{

   var deletedsn=hdsn.value;

   if(deletedsn.indexOf(ifcheckedsn)>=0)

  {

    deletedsn=deletedsn.replace(ifcheckedsn,'');

  }

  hdsn.value=deletedsn;

}

  alert(hdsn.value);

}

你可能感兴趣的:(checkbox)