zoukankan      html  css  js  c++  java
  • Jquery

    html:

    <!DOCTYPE html>
    <html>
    <head>
        <title>节点列表</title>
        <link rel="stylesheet" type="text/css" href="__PUBLIC__/Css/Public.css">
        <link rel="stylesheet" type="text/css" href="__PUBLIC__/Css/node.css">
        <script type="text/javascript" src="__PUBLIC__/Js/jquery.js"></script>
        <script type="text/javascript" src="__PUBLIC__/Js/node.js"></script>
    </head>
    <body>
        <div id="wrap">
            <div>
                <a href="<{:U('/Admin/Rbac/role')}>" class="add-app">返回</a>
            </div>
            <div>
                <foreach name="node" item="app">
                    <div class="app">
                        <p>
                            <strong><{$app.title}></strong>
                            <input type="checkbox" name="access[]"  value="<{$app.id}>_1" level='1' />
                        </p>
    
                        <foreach name="app.child" item="action">
                            <dl>
                                <dt>
                                    <strong><{$action.title}></strong>
                                    <input type="checkbox" name="access[]" value="<{$action.id}>_3" level='2'  />
                                </dt>
    
                                <foreach name="action.child" item="func">
                                    <dd>
                                        <span><{$func.title}></span>
                                        <input type="checkbox" name="access[]" value="<{$func.id}>_3" level='3'  />
                                    </dd>
                                </foreach>
                            </dl>
                        </foreach>
                    </div>
                </foreach>
            </div>
        </div>
    </body>
    </html>

    JS:

    $(document).ready(function(){
        $('input[level="1"]').click(function() {            
            var inputs = $(this).parents('.app').find('input');
            $(this).prop('checked') ? inputs.prop('checked', true) : inputs.removeAttr('checked', false);
        });
    
        $('input[level="2"]').click(function() {
            var inputs = $(this).parents('dl').find('input');
            $(this).prop('checked') ? inputs.prop('checked', true) : inputs.removeAttr('checked', false);
        });
    });
  • 相关阅读:
    【转】Hibernate 配置
    【转】关于Log4j
    This project is not a myeclipse hibernate project . Assuming Hibernate 3 capabilities configuration editor
    java集合框架分析
    鸡蛋篮子与格子取数
    贪心与回溯与DP
    NP问题
    子集生成和全排列
    JDK动态代理实现原理(转)
    java类初始化/生命周期及反射及动态代理
  • 原文地址:https://www.cnblogs.com/KTblog/p/5187120.html
Copyright © 2011-2022 走看看