Single box check box is selected after the JS code processing
<Scripttype= "Text/javascript"> functionCheck () {document.getElementById ("checked"). Style.display="Block"; varRadio=Document.getelementsbyname ("Sex");//This cannot be getElementById (), otherwise only the first value will be taken. for(varI=0; I<Radio.length;i++){ if(radio[i].checked) {alert (radio[i].value); Alert ("Wocaonima"); } } } functioncheckbox () {varcc=Document.getelementsbyname ("checkbox"); varvalue=""; for(varI=0; I<Cc.length;i++){ if(cc[i].checked==true) {Value+=Cc[i].value; }} alert (value); } </Script> </Head> <Body> <DivID= "Shenmewanyi"> <inputtype= "Radio"name= "Sex"value= "0">male<inputtype= "Radio"name= "Sex"value= "1">female<inputtype= "Radio"name= "Sex"value= "2">Confidentiality<inputtype= "button"value= "Submit"onclick= "Check ()"> </Div> <DivID= "Checked"style= "Display:none;"> <inputtype= "checkbox"name= "checkbox"value= "Music">Music<inputtype= "checkbox"name= "checkbox"value= "read">Read<inputtype= "checkbox"name= "checkbox"value= "Paint">painting<inputtype= "button"value= "Submit"onclick= "checkbox ()"> </Div>
The JS code value of the Radio check box