前端单选框实现父/子级包函选项功能
来源:互联网 发布:apache impala 编辑:程序博客网 时间:2024/06/09 00:08
<html>
<head>
<title>用户列表</title>
<script type="text/javascript" src="__PUBLIC__/js/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
$("input").click(function(){
var level = $(this).attr("level");
if(level == 1){
var str = "_";
var inputs = $('input[value*='+str+']');
$(this).attr("checked") ? inputs.attr("checked", true) : inputs.removeAttr("checked");
}
else if(level == 2){
var id = $(this).attr("id");
var inputs = $('input[pid='+id+']');
$(this).attr("checked") ? inputs.attr("checked", true) : inputs.removeAttr("checked");
}
else if(level == 3){
var pid = $(this).attr("pid");
var inputs = $('input[id='+pid+']');
var ppid = inputs.attr("pid");
var ppInputs = $('input[id='+ppid+']');
var count = $('input[pid='+pid+'][checked]').length;
if(count < 1){
inputs.removeAttr("checked");
ppInputs.removeAttr("checked");
}
else{
inputs.attr("checked", true);
ppInputs.attr("checked", true);
}
}
})
})
</script>
</head>
<body>
<table border="1">
<tr>
<td align="center">权限分配</td>
</tr>
<tr>
<td align="left">给<span style="font-weight:bold;">[{$name}]</span>分配权限</td>
</tr>
<tr>
<td>
<foreach name="nodelist" item="vo">
<p style="text-indent:{$vo['level']*20}px; <if condition='$vo[level] eq 3'>float:left;<else />clear:both;</if>">
<input type="checkbox" id="{$vo.id}" <if condition="$vo.access eq 1">checked="checked"</if> name="access[]" value="{$vo.id}_{$vo.level}" pid="{$vo.pid}" level="{$vo.level}">
<span><if condition="$vo['level'] eq 1">[项目]<elseif condition="$vo['level'] eq 2"/>[模块]</if></span>
<lable name="name" value="{$vo.id}">{$vo.title}</lable>
</p>
</foreach>
</td>
</tr>
</table>
</body>
</html>
<head>
<title>用户列表</title>
<script type="text/javascript" src="__PUBLIC__/js/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
$("input").click(function(){
var level = $(this).attr("level");
if(level == 1){
var str = "_";
var inputs = $('input[value*='+str+']');
$(this).attr("checked") ? inputs.attr("checked", true) : inputs.removeAttr("checked");
}
else if(level == 2){
var id = $(this).attr("id");
var inputs = $('input[pid='+id+']');
$(this).attr("checked") ? inputs.attr("checked", true) : inputs.removeAttr("checked");
}
else if(level == 3){
var pid = $(this).attr("pid");
var inputs = $('input[id='+pid+']');
var ppid = inputs.attr("pid");
var ppInputs = $('input[id='+ppid+']');
var count = $('input[pid='+pid+'][checked]').length;
if(count < 1){
inputs.removeAttr("checked");
ppInputs.removeAttr("checked");
}
else{
inputs.attr("checked", true);
ppInputs.attr("checked", true);
}
}
})
})
</script>
</head>
<body>
<table border="1">
<tr>
<td align="center">权限分配</td>
</tr>
<tr>
<td align="left">给<span style="font-weight:bold;">[{$name}]</span>分配权限</td>
</tr>
<tr>
<td>
<foreach name="nodelist" item="vo">
<p style="text-indent:{$vo['level']*20}px; <if condition='$vo[level] eq 3'>float:left;<else />clear:both;</if>">
<input type="checkbox" id="{$vo.id}" <if condition="$vo.access eq 1">checked="checked"</if> name="access[]" value="{$vo.id}_{$vo.level}" pid="{$vo.pid}" level="{$vo.level}">
<span><if condition="$vo['level'] eq 1">[项目]<elseif condition="$vo['level'] eq 2"/>[模块]</if></span>
<lable name="name" value="{$vo.id}">{$vo.title}</lable>
</p>
</foreach>
</td>
</tr>
</table>
</body>
</html>
0 0
- 前端单选框实现父/子级包函选项功能
- Fragments实现选项卡功能
- Jquery实现选项卡功能
- js实现选项卡功能
- Jquery实现选项卡功能
- js_day02_js实现选项卡功能
- jquery实现选项卡功能
- Javascript实现选项卡功能
- angularJS-实现选项卡功能
- js选项卡功能实现
- 前端实现视频录制功能
- MultiView结合DropDownList实现选项卡功能
- 用js实现选项卡功能
- Swing实现选项卡功能(JTabbedPane)
- js 函数 实现导航选项卡功能
- Android中选项卡功能的实现
- 简单的选项卡功能实现
- HTML+JavaScript实现选项卡功能
- cc150:将一个栈按升序排序
- TCP/IP协议族:RFC
- 单火线取电
- 新人报到
- 虚拟内存与虚拟地址空间
- 前端单选框实现父/子级包函选项功能
- poj 2155 Matrix
- netty5.0之server端NioServerSocketChannel的bind分析
- 【java】getAbsolutePath()方法详解
- Android中HandlerThread
- chrome浏览器卡死问题解决
- 冀该统梦捉倍易哨鞠揖锻逊
- UVA Master-Mind Hints()
- 关于Eclipse Adt插件删除不掉的解决方法!