单选框示例:
<script language="javascript">
function chec(){
for(i=0;i<document.form1.u_input.length;i++){
if(document.form1.u_input[i].checked == true){
alert(document.form1.u_input[i].value);
return false;
break;
}
}
}
</script>
<form name="form1" method="post" onSubmit="chec();">
<table width="24%" border="0" cellspacing="0" cellpadding="0" height="144">
<tr>
<td height="27"><div align="center" class="style1">投票:</div></td>
</tr>
<tr>
<td height="20"><div align="left" class="style1">
<input type="radio" value="1" name="u_input">
很满意</div></td>
</tr>
<tr>
<td height="20"><div align="left" class="style1">
<input type="radio" value="2" name="u_input">基本满意</div></td>
</tr>
<tr>
<td height="20"><div align="left" class="style1">
<input type="radio" value="3" name="u_input">一般</div></td>
</tr>
<tr>
<td height="20"><div align="left" class="style1">
<input type="radio" value="4" name="u_input">不满意</div></td>
</tr>
<tr>
<td height="37" valign="bottom">
<div align="left">
<input name="submit" type="submit" value="投票" >
</div></td></tr>
</table>
</form>
(复选框和单选框是一样的在此不做赘述)
for(i=0;i<document.form2.Mobile.length;i++){
if(document.form2.Mobile[i].checked == true){
alert(document.form2.Mobile[i].value);
return true;
break;
}
}