<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>test</title>
<script src="jquery-1.4.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$(".radioItem").change(
function() {
var $selectedvalue = $("input[name='rl$tt']:checked").val();
alert($selectedvalue);
if ($selectedvalue == 1) {
window.location = "http://www.g.cn";
}
else {
window.location = "http://www.baidu.com";
}
});});
</script>
</head>
<body>
<table id="rl">
<tr>
<td><label>谷歌</label>
<input id="rl_1" class="radioItem" checked="checked" name="rl$tt" type="radio" value="1" />
<label>百度</label>
<input id="rl_2" class="radioItem" name="rl$tt" type="radio" value="2" /></td>
</tr>
</table>
</body>
</html>
如果是许多的radio那么可以使用遍历的方式
<%@ page language="java" import="java.util.*" pageEncoding="GB2312"%>
<html>
<head>
<script type="text/javascript" >
function baidu(){
var radios = document.getElementsByName("a");
for ( var i = 0; i < radios.length; i++) {
if (radios[i].checked==true) {
i++;
alert("你选中的是第"+i+"个单选框。值为:"+radios[--i].value);
}
}
}
</script>
</head>
<body>
<input type="radio" name="a" value="1"/>1
<input type="radio" name="a" value="2"/>2
<input type="radio" name="a" value="3"/>3
<input type="radio" name="a" value="4"/>4
<input type="button" onClick="baidu()" value="按下"/>
</body>
</html>