根据数据库中的值用js设置RadioButtonList选中与否

 
  1. function setcheck(id,ddd)//id表示控件ID号,ddd表示值
  2.   {
  3.     var   radiolist   =  id;  
  4.    
  5.       for(var   i=0;i<document.getElementById(radiolist).rows.length;i++)  
  6.       {  
  7.           for(var   x=0;x<document.getElementById(radiolist).rows[i].cells.length;x++)  
  8.           {  
  9.               if(document.getElementById(radiolist).rows[i].cells[x].firstChild!="undefine")  
  10.               {    
  11.                   if(document.getElementById(radiolist).rows[i].cells[x].firstChild.value==ddd)  
  12.                   {  
  13.                     document.getElementById(radiolist).rows[i].cells[x].firstChild.checked=true;  
  14.                   }
  15.                                              
  16.               }  
  17.           }  
  18.       }
  19.   } 

你可能感兴趣的:(数据库)