Home > Web Front-end > JS Tutorial > Use js's for loop to get the selected radio value_javascript skills

Use js's for loop to get the selected radio value_javascript skills

WBOY
Release: 2016-05-16 17:19:25
Original
1158 people have browsed it

For example:

Copy code The code is as follows:





  • where the name attribute The values ​​must be the same. Next, use js to get the selected value:
    Copy the code The code is as follows:

    var zt = document.getElementsByName("zt");

    for(var i=0;iif(zt[i].checked) {
    alert(zt[i].value);
    }
    }

    Use a for loop to get it done.
    Related labels:
    source:php.cn
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template