radiogroup的问题
radiogroup的问题
我这样写
function radiogroup(){
var fieldradiogroup = document.forms[0].radiogroup;
var valueradiogroup = fieldradiogroup.value;
alert(valueradiogroup);
}
form里面的内容
是 <input type= "radio " name= "radiogroup " value= "paystub " onclick= "radiogroup() " > 否 <input type= "radio " name= "radiogroup " value= "messagequestion " checked onclick= "radiogroup() ">
为什么我选定之后会弹出报错对话框说不 "对象不支持此属性和方法 "哦??
------解决方案--------------------function radiogroup(){
var fieldradiogroup = document.getElementsByName( "radiogroup ");
for(i = 0;i <fieldradiogroup.length;i++)
{
alert(fieldradiogroup[i].value);
}
}