日期:2014-05-20  浏览次数:20699 次

javascript checkbox 问题
var A = document.getElementById('A');//<input type="checkbox" id="A">

怎么在javascript中选中?

------解决方案--------------------
HTML code

<BODY     onload= "iniCheckBox() "> 
      <c:forEach   var= "cc "   items= "${tcList   } "> 
                      <input   type= "checkbox "   name= "C1 "   value= "ON "   id= "${cc.charge_code   } "   >   
                              ${cc.charge_name   } 
        </c:forEach> 
function   iniCheckBox()   
              {       
  document.getElementById( "A ").checked=true;       
} 

页面源码: 
  收费项目: 
  <input   type= "checkbox "   name= "C1 "   value= "ON "   id= "A "   >     开户费   
  <input   type= "checkbox "   name= "C1 "   value= "ON "   id= "B "   >     漫游费 
  <input   type= "checkbox "   name= "C1 "   value= "ON "   id= "C "   >     押金 
  <input   type= "checkbox "   name= "C1 "   value= "ON "   id= "D "   >     入网费 
  <input   type= "checkbox "   name= "C1 "   value= "ON "   id= "E "   >     选号费   <p>