Home  >  Article  >  Web Front-end  >  用js的for循环获取radio选中的值_javascript技巧

用js的for循环获取radio选中的值_javascript技巧

WBOY
WBOYOriginal
2016-05-16 17:19:251033browse

例如:

复制代码 代码如下:





  • 其中name属性值肯定是一样的,接下来用js获取选中的值:
    复制代码 代码如下:

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

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

    用一for循环就搞定了。
    Statement:
    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