jquery获取一组radio被选中项的值
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" c/>
<script type="text/javascript" src="jquery.js">
</script>
<script type="text/javascript">
$(function(){
$('#form1').submit(function(){
var item = $('input[@name=items][@checked]').val();
alert(item);
return false;
});
});
</script>
<title>Get Radio value Document</title>
</head>
<body>
<form id="form1">
<input type="radio" name="items" id="item1" value="a"/>A
<br/>
<input type="radio" name="items" id="item2" value="b"/>B
<br/>
<input type="radio" name="items" id="item3" value="c"/>C
<br/>
<input type="radio" name="items" id="item4" value="d"/>D
<br/>
<input type="radio" name="items" id="item5" value="e"/>E
<br/>
<input type="radio" name="items" id="item6" value="f"/>F
<br/>
<input type="radio" name="items" id="item7" value="g"/>G
<br/>
<input type="radio" name="items" id="item8" value="h"/>H
<br/>
<input type="submit" id="btn1">
</form>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" c/>
<script type="text/javascript" src="jquery.js">
</script>
<script type="text/javascript">
$(function(){
$('#form1').submit(function(){
var item = $('input[@name=items][@checked]').val();
alert(item);
return false;
});
});
</script>
<title>Get Radio value Document</title>
</head>
<body>
<form id="form1">
<input type="radio" name="items" id="item1" value="a"/>A
<br/>
<input type="radio" name="items" id="item2" value="b"/>B
<br/>
<input type="radio" name="items" id="item3" value="c"/>C
<br/>
<input type="radio" name="items" id="item4" value="d"/>D
<br/>
<input type="radio" name="items" id="item5" value="e"/>E
<br/>
<input type="radio" name="items" id="item6" value="f"/>F
<br/>
<input type="radio" name="items" id="item7" value="g"/>G
<br/>
<input type="radio" name="items" id="item8" value="h"/>H
<br/>
<input type="submit" id="btn1">
</form>
</body>
</html>