帮我看看这个简单问题 f_get(){a=getElementsByName("q")for(i=0;i<a.length;i++)if(a[i].checked)alert(a[i].value)} 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 首先你的radio寫錯了<form name ="w"><input type=radio value=1 name=q checked></input><input type=radio value=2 name=q></input></form><input type=button value=getValue onclick="f_get()"><script>function f_get(){var a=document.w;for(i=0;i<a.length;i++) if(a.elements[i].checked) {alert(a.elements[i].value);break;}}</script> sorryf_get(){a=document.getElementsByName("q")for(i=0;i<a.length;i++)if(a[i].checked)alert(a[i].value)} 还可以:<form name ="w"><input type=radio value=1 name=q><input type=radio value=2 name=q></form><script language="JavaScript">a=document.w.qfor(i=0;i<a.length;i++)alert(a[i].value)</script> 提示 Fusioncharts 未定义 怎么回事 keyCode的问题 javascript脚本的位置 为table插入行时,怎么写行事件?? 点击一个超链接,怎么得到它的URL 如何在javascrip中获得label的text window.open()总是弹出一个新的窗口,如何对弹出的新窗口进行判断,如果它存在就刷新,如果不存在才弹出? 怎样让text不提交? 相同表单及action,通过两个button传递不同参数值 关于页面html代码有变更后选中状态保留问题 请问一个参数传递的问题 如何在javascript里判断一个对象是否存在
<input type=radio value=1 name=q checked></input>
<input type=radio value=2 name=q></input>
</form>
<input type=button value=getValue onclick="f_get()">
<script>
function f_get()
{
var a=document.w;
for(i=0;i<a.length;i++)
if(a.elements[i].checked)
{alert(a.elements[i].value);break;}
}
</script>
f_get()
{
a=document.getElementsByName("q")
for(i=0;i<a.length;i++)
if(a[i].checked)
alert(a[i].value)
}
<form name ="w">
<input type=radio value=1 name=q>
<input type=radio value=2 name=q>
</form>
<script language="JavaScript">
a=document.w.q
for(i=0;i<a.length;i++)
alert(a[i].value)
</script>