js取radio值

来源:互联网 发布:知乎越来越垃圾 编辑:程序博客网 时间:2024/05/16 14:10
function ok() {   var temp=document.getElementsByName("radio");   for (i=0;i<temp.length;i++){   //遍历Radio     if(temp[i].checked)       {alert("你选择了"+temp[i].value);       //获取Radio的值       document.form2.textfield.value="你选择了"+temp[i].value;       //传递给另外一个表单       }   } }