Jquery checkbox級聯選擇 -- 通用型
来源:互联网 发布:apache you dont have 编辑:程序博客网 时间:2024/05/04 02:24
/*checkbox 上需要添加index字段 格式如下:父節點為1則子節點為1_1,1_2 以此類推*/$j(function($) {$(":checkbox").click(function(){var index = $(this).attr("index");$(":checkbox[index^="+index+"]").attr("checked",$(this).is(":checked"));var parent_index = index.substring(0,index.length - 2);$(":checkbox[index="+parent_index+"]").attr("checked",false);var parentIsCheck = false;$(":checkbox[index^="+parent_index+"]").each(function(i){if($(this).is(":checked")){parentIsCheck = true;}});$(":checkbox[index="+parent_index+"]").attr("checked",parentIsCheck);var parent_parent_index = index.substring(0,parent_index.length - 2);var parent_parent_is_check = false;$(":checkbox[index="+parent_parent_index+"]").attr("checked",parent_parent_is_check);$(":checkbox[index^="+parent_parent_index+"]").each(function(i){if($(this).is(":checked")){parent_parent_is_check = true;}});$(":checkbox[index="+parent_parent_index+"]").attr("checked",parent_parent_is_check);});});
關鍵在於index 這個字段 -- js代碼只不過是判定而已~~~
<dt><img src="/crm/images/tree/tree_node_e_2.gif" /><img src="/crm/images/tree/folder_off.gif" /><span class="text-g"> <input type="checkbox" name="functionIds" value='1' style="margin:3px 0 0;" index='1'/><span style="margin-left:3px">建立活動</span></span></dt><dt><img src="/crm/images/tree/tree_vert.gif" /><img src="/crm/images/tree/tree_node_n_0.gif" /><img src="/crm/images/tree/item.gif" /><input type="checkbox" name="functionIds" value='2' style="margin:3px 0 0;" index='1_1'/><span style="margin-left:3px">設定客戶群</span>:<input type="checkbox" name="functionIds" value='3' style="margin:3px 0 0;" index='1_1_1' />基金<input type="checkbox" name="functionIds" value='4' style="margin:3px 0 0;" index='1_1_2' />信用卡<input type="checkbox" name="functionIds" value='5' style="margin:3px 0 0;" index='1_1_3' />黃金存摺</dt><dt><img src="/crm/images/tree/tree_vert.gif" /><img src="/crm/images/tree/tree_node_n_0.gif" /><img src="/crm/images/tree/item.gif" /><input type="checkbox" name="functionIds" value='6' style="margin:3px 0 0;" index='1_2'/><span style="margin-left:3px">訂定活動</span>:<input type="checkbox" name="functionIds" value='7' style="margin:3px 0 0;" index='1_2_1' />基金<input type="checkbox" name="functionIds" value='8' style="margin:3px 0 0;" index='1_2_2' />信用卡<input type="checkbox" name="functionIds" value='9' style="margin:3px 0 0;" index='1_2_3' />黃金存摺</dt><dt><img src="/crm/images/tree/tree_vert.gif" /><img src="/crm/images/tree/tree_node_e_0.gif" /><img src="/crm/images/tree/item.gif" /><input type="checkbox" name="functionIds" value='10' style="margin:3px 0 0;" index='1_3'/><span style="margin-left:3px">活動計劃</span></dt><dt>
------------------------------------------------------------------------------------------------------------------------------------------------------------------
- Jquery checkbox級聯選擇 -- 通用型
- jquery checkbox
- Jquery CheckBox
- jquery checkbox
- jQuery - Checkbox
- jquery checkbox
- jQuery-checkbox
- jquery 实现checkbox选中,jquery checkbox
- 通用型adapter
- Generics 通用型
- jQuery checkbox问题
- Jquery 实现全选checkbox
- jquery checkbox部分全选
- jquery radio checkbox
- jquery checkbox 循环
- jquery checkbox 相关操作
- jquery 操作checkbox
- 用jQuery控制checkbox
- 使用WinDbg调试Silverlight中遇到“Failed to find runtime DLL (clr.dll), 0x80004005”问题的解决方法之一
- Android开发之Intent.Action
- Android 用sax解析xml文件
- 查看oracle表空间大小
- android 后台发彩信
- Jquery checkbox級聯選擇 -- 通用型
- jquery radio取值,checkbox取值,select取值,radio选中,checkbox选中,select选中,及其相关
- 黑马程序员_java基础6-集合框架Collection和泛型
- UNDO表空间备份恢复(一)
- ORACLE物化视图
- 解决sqlplus下方向键的问题
- Improving Joomla's Queries
- 查看Oracle表空间大小的方法
- 在从1到n的正数中1出现的次数