<!DOCTYPE HTML><HTML> <Head> <MetaCharSet= "UTF-8"> <title></title> </Head> <Body> <!--pops the value of the selected radio box - <inputtype= "button"name=""ID=""value= "Choose the male choice female?" "onclick= "Danxuan ()" /> <BR/> <inputtype= "Radio"name= "Sex"value= "1" />male<inputtype= "Radio"name= "Sex"value= "0" />female<BR/> <!--Select all of the check boxes - <inputtype= "checkbox"ID= "Quanxuan"onclick= "Quanxuan ()" />Select All<BR/> <inputtype= "checkbox"name= "Fruit"value= "1" />Apple<inputtype= "checkbox"name= "Fruit"value= "2" />Banana<inputtype= "checkbox"name= "Fruit"value= "3" />Pear<inputtype= "checkbox"name= "Fruit"value= "4" />Orange<inputtype= "checkbox"name= "Fruit"value= "5" />Orange<BR/> </Body></HTML><Scripttype= "Text/javascript"> //pops the value of the selected radio box functionDanxuan () {//receive a collection of sex with Sex1 varsex1=Document.getelementsbyname ("Sex"); //determine which option of the Sex1 collection is selected for(varI=0; I<2; I++){ if(sex1[i].checked) {//Popup value for this optionalert (sex1[i].value); } } } //Select all of the check boxes functionQuanxuan () {//receive fruit collection with SG varSG=Document.getelementsbyname ("Fruit"); //receive a fully selected div with QX varQX=document.getElementById ("Quanxuan"); //for loop loops find different fruits for(i=0; I<Sg.length;i++){ //If the Select All box is selected, all the fruits are selected and vice versa. if(qx.checked) {sg[i].checked=true; }Else{sg[i].checked= false; } } }</Script>
JAVASCRIPT-13 (Find the value of the Radio box and the check box select all operation)