62,071
社区成员
发帖
与我相关
我的任务
分享
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
/* 如果你要记录用户选择 使用自己办法保存这个value */
$(function () {
$("input[type='checkbox']").click(function () {
$("input[type='checkbox']").removeAttr("checked");
$(this).attr("checked", "checked");
if ($(this).attr("value") == "A") {
$("#tb2").hide();
$("#tb1").show();
}
else {
$("#tb1").hide();
$("#tb2").show();
}
});
});
</script>
</head>
<body>
<div>
<input type="checkbox" value="A" />
<input type="checkbox" value="B" />
</div>
<div>
<table id="tb1" style="display: none;">
<tr>
<td>TB1</td>
</tr>
</table>
<table id="tb2" style="display: none;">
<tr>
<td>TB2</td>
</tr>
</table>
</div>
</body>
</html>