JAVASCRIPT-13 (Find the value of the Radio box and the check box select all operation)

Source: Internet
Author: User

<!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)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.