如返回的是json格式的数据,下面是每个列的标注,其中Expanded为true就是展开
"MenuId", "MenuName", "Url", "level", "parent", "IsLeaf", "Expanded", "Loaded"
列
{
"page": 1,
"records": 10000,
"total": 1,
"rows": [
{
"id": 0,
"cell": [
"510",
"1",
"",
"1",
"0",
false,
true,
true
]
},
{
"id": 1,
"cell": [
"511",
"11",
"",
"2",
"510",
false,
true,
true
]
},
{
"id": 2,
"cell": [
"51101",
"111",
"ur111",
"3",
"511",
true,
true,
true
]
},
{
"id": 3,
"cell": [
"51102",
"112",
"url112",
"3",
"511",
true,
true,
true
]
},
{
"id": 42,
"cell": [
"12",
"报表",
"",
"2",
"510",
false,
true,
true
]
},
{
"id": 43,
"cell": [
"121",
"test",
"test",
"3",
"512",
true,
true,
true
]
},
{
"id": 44,
"cell": [
"122",
"rtest",
"test",
"3",
"512",
true,
true,
true
]
}
]
}
有几个地方可能有问题:
部分浏览器不支持form1.这种方法访问控件,使用document.方法。
if(elements[i].type=='checkbox') {
if(elements[i].checked==false){
elements[i].checked=true}}
这样写会比较好点:
if (elements[i].type == 'checkbox') elements[i].checked = !elements[i].checked
<head runat="server">
<title></title>
<script src="Scripts/jquery1.82.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$("input[type=checkbox]").click(function () {
$(this).siblings().attr("checked", false)
})
})
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="yx">
优秀:<input type="checkbox" value="1" />&nbsp<input type="checkbox" value="1" />&nbsp<input
type="checkbox" value="1" />&nbsp
</div>
<div id="lh">
良好:<input type="checkbox" value="1" />&nbsp<input type="checkbox" value="1" />&nbsp<input
type="checkbox" value="1" />&nbsp
</div>
<div id="yb">
一般:<input type="checkbox" value="1" />&nbsp<input type="checkbox" value="1" />&nbsp<input
type="checkbox" value="1" />&nbsp
</div>
</form>
</body>
我这是同一行只能选择一个的,你自己可以改改