<html>
<head>
<script type = "text/javascript">
function clickk(){
x = document.getElementsByName("aa");
count = 0
for (i=0;i< x.length;i++ )
{
if (x[i].checked)
{
count++;
}
}
if (count == 0)
{
alert("no radio");
}
}
</script>
</head>
<body>
<form name = 'myform'>
<input type ="radio" name = "aa">aaaa</input>
<input type ="radio" name = "aa">bbbb</input>
<input type ="radio" name = "aa">cccc</input>
<br/>
<input type = "button" value ="javascript" οnclick="clickk();"></input>
<br/>
<input type = "text"></input>
</form>
</body>
</html>
javascript 验证 radiobox
最新推荐文章于 2017-11-26 09:55:00 发布