js判断radio是否被选中(一)

< html >
< head >
< title >
votejsp
< / title >
< script language = "javascript" type = "text/javascript" >
<!--
function validate(){
var resualt=false;
for(var i=0;i<document.frmvote.radiobutton.length;i++)
{
    
    if(document.frmvote.radiobutton[i].checked)
    {
      resualt=true;
    }
}
if(!resualt)
{
    alert(" 为啥不选一个捏~!");
}
return resualt;
}
-->

< / script >
< / head >
< body bgcolor = "#ffffff" >
< h1 >
关于购房热潮的调查问卷


< / h1 >
< h3 >
问题1:如今房价居高不下,
< / h3 >
< form method = "post" action = "voteservlet" name = "frmvote" onsubmit = "return(validate())" >
< br > < br >
请选择:< br / >
< input type = "radio" name = "radiobutton" value = "A" / > A . 拥有一套货一套以上< br / >
< input type = "radio" name = "radiobutton" value = "B" / > B . 还没有,不过计划要买< br / >
< input type = "radio" name = "radiobutton" value = "C" / > C. 有这个想法,不过 还没有< br / >
< input type = "radio" name = "radiobutton" value = "D" / > D. 没有这个 想法,不买房< br / >
< input type = "submit" name = "Submit" value = "投票" >
< input type = "reset" value = "重新选择" >
< / form >
< / body >
< / html >

阅读更多
个人分类: JS代码
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭