Skip to content

Instantly share code, notes, and snippets.

@pzzrudlf
Created November 5, 2015 05:37
Show Gist options
  • Save pzzrudlf/14daf83f63872f28d80e to your computer and use it in GitHub Desktop.
Save pzzrudlf/14daf83f63872f28d80e to your computer and use it in GitHub Desktop.
var obj=document.getElementsByName('test'); //选择所有name="'test'"的对象,返回数组;取到对象数组后,我们来循环检测它是不是被选中
var s='';
for(var i=0; i<obj.length; i++){
if(obj[i].checked) s+=obj[i].value+','; //如果选中,将value添加到变量s中
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment