JQuery radio checked 选中事件2010-08-09 11:57<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<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>
<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>