JS determines if the Radio radio button is selected and pops the value information

Source: Internet
Author: User

Problems solved in today's project: JS to determine if the Radio radio button is selected and pop-up value information, initially always get the value of Radio, and later found that there are some problems in the logic, I would like to share the code to leave notes and share the reference to the brothers who encounter such problems  :
<script type= "Text/javascript" >//Judging a function above 5 radio that is selectedfunctionjudgeradioclicked () {//get radio button name Collection    varRadios = Document.getelementsbyname ("RADIO_TJ"); //traverse the name collection based on the name collection length     for(vari=0;i<radios.length;i++)    {         //Determine which radio button is selected        if(radios[i].checked) {//pops the value of the selected radio buttonalert (radios[i].value); }     } }                            </script>

Note://Get single radio button name collection//var radios = Document.getelementsbyname ("RADIO_TJ"); The "RADIO_TJ" in is the Name property of the radio button collection.

Original address: http://blog.csdn.net/songyanjun2011/article/details/7186864

JS determines if the Radio radio button is selected and pops the value information

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.