<script>
var yy=””;
function test(){
for(i=0;i<document.y.ye.length;i++){
if(document.y.ye[i].checked){
alert(document.y.ye[i].nextSibling.nodeValue);
}
}
}
</script>
<form name=”y” method=get>
<input type=hidden id=”yexj00″>
<input type=radio value=”ye1″ name=”ye” checked> Option One <input type=radio value=”ye2″ name=”ye”> Option Two <input type=radio value=”ye3″ name=”ye”> Option Three <input type=radio value=”ye4″ name=”ye”> Option Four
<input type=button value=test onclick=”test()”>
</form>
<script language=”javascript”>
function changing()
{
var radion;
radion=document.form1.radiobutton;
if(radion==null)
{
alert(“请选择要变更的许可证”);
}
else
alert(“yes”);
}
</script>
<form name=”form1″ method=”post” action=””>
<input type=”radio” name=”radiobutton” value=”radiobutton”>
<input type=”button” name=”Submit” value=”提交” onClick=”changing()”>
</form>
for(var i=0;i<form1.radiobutton.length)
{
if (form1.radiobutton.item[i].checked==true){
//具体操作
}
}
JS判断单选框是否选中
<form name=”myform” action=”” method=”” onsubmit=”return check()”>
<input type=”radio” name=”picno” value=”1″>选择1
<input type=”radio” name=”picno” value=”2″>选择2
<input type=”radio” name=”picno” value=”3″>选择3
<input type=”submit” value=”Submit”>
<input type=”reset” value=”Reset”>
</form>
<script language=”JavaScript”>
function check(){
var flag=0
for(i=0;i<myform.picno.length;i++)
if(myform.picno[i].checked==true){
flag=1
break
}
if(!flag){
alert(“请先选择!”)
return false
}
}
</script>
评论