日期:2014-05-16  浏览次数:20396 次

js判断radio是否选中并取值
<script type="text/javascript">
	function check(){
		var len=document.form1.r1.length;
		for(i=0;i<len;i++){
			if(document.form1.r1[i].checked){
				alert(document.form1.r1[i].value);
				return;
			}
		}
	}
</script>

<form name="form1">
	<input type="radio" name="r1" value="1" />1&nbsp;
    <input type="radio" name="r1" value="2" />2&nbsp;
    <input type="radio" name="r1" value="3" />3
	<input type="button" value="button" onclick="check()" />
</form>