日期:2014-05-17  浏览次数:20862 次

脚本小问题!!
<script>
function   asb()
{
alert(document.userinfo.aas.value)
}
</script>



<form   name=userinfo   method=post   action=>  
<input   name= "aas "   type= "radio "   value= "aas "   checked   />
<input   name= "aas "   type= "radio "   value= "ssss "   />
<input   name= " "   type= "submit "   value= "提交 "   onclick= "asb() "   />
</form>

为什么提交后出现“undefined”


------解决方案--------------------
function asb()
{
var list = document.userinfo.aas;
if(list.length){
for(var i=0;i <list.length;i++) if(list[i].checked){alert(list[i].value);break;}
}
else alert(list.value);
}