• JQuery 进入页面默认给已赋值的复选框打钩


        效果

        

        JQuery代码:

        $("#menuTree").find("div span").click(function () {
                    currmenuid = this.id;
                    var currmenuname = LoadCurrMenuName();
                    $('#authName').text(currmenuname);
                    //默认给已赋值的菜单打钩
                    var rightvalue= AutoCheck();
                    var str = "";
                    var strArr = [];
                    for (var i = 0; i < rightvalue.length; i++) {
                        str = rightvalue[i];
                        strArr.push(str);
                    }
                    var input = $('.che');
                    for (var n = 0; n < strArr.length; n++) {
                        if (strArr[n] == 1) {
                            input[n].checked = true;
                        }
                        else {
                            input[n].checked = false;
                        }
                    }
                })

        HTML代码:

        <div style="100%; margin:auto">

                            <fieldset class="duxuan">

                                <legend id="authName" style="font-size:12px;">权限管理</legend>
                                <div class="duleft">
                                    <ul>
                                        <li>  <input class="che" type="checkbox" name="CheckboxGroup1" value="0" id="CheckboxGroup1_1" />有效 </li>
                                        <li>   <input class="che" type="checkbox" name="CheckboxGroup1" value="0" id="CheckboxGroup1_2" />银码  </li>
                                        <li>   <input class="che" type="checkbox" name="CheckboxGroup1" value="0" id="CheckboxGroup1_3" />查询  </li>
                                        <li>   <input class="che" type="checkbox" name="CheckboxGroup1" value="0" id="CheckboxGroup1_4" />新增   </li>
                                        <li>   <input class="che" type="checkbox" name="CheckboxGroup1" value="0" id="CheckboxGroup1_5" />修改  </li>
                                        <li>  <input class="che" type="checkbox" name="CheckboxGroup1" value="0" id="CheckboxGroup1_6" />删除  </li>
                                        <li>  <input class="che" type="checkbox" name="CheckboxGroup1" value="0" id="CheckboxGroup1_7" />提交  </li>
                                        <li>   <input class="che" type="checkbox" name="CheckboxGroup1" value="0" id="CheckboxGroup1_8" />统计  </li>
                                        <li>   <input class="che" type="checkbox" name="CheckboxGroup1" value="0" id="CheckboxGroup1_9" />复核  </li>
                                        <li>  <input class="che" type="checkbox" name="CheckboxGroup1" value="0" id="CheckboxGroup1_10" />签收  </li>
                                        <li>   <input class="che" type="checkbox" name="CheckboxGroup1" value="0" id="CheckboxGroup1_11" />返回  </li>
                                        <li>   <input class="che" type="checkbox" name="CheckboxGroup1" value="0" id="CheckboxGroup1_12" />导出    </li>
                                        <li>   <input class="che" type="checkbox" name="CheckboxGroup1" value="0" id="CheckboxGroup1_13" />打印 </li>
                                        <li>   <input class="che" type="checkbox" name="CheckboxGroup1" value="0" id="CheckboxGroup1_14" />查看 </li>
                                        <li>  <input class="che" type="checkbox" name="CheckboxGroup1" value="0" id="CheckboxGroup1_15" />隶属角色  </li>
                                        <li>   <input class="che" type="checkbox" name="CheckboxGroup1" value="0" id="CheckboxGroup1_16" />隶属用户  </li>
                                    </ul>
                                </div>
                                <div class="duright">
                                    <div class="rleft">
                                        <div class="rlup" id="selectAll" role="button">全选</div>
                                        <div class="rldown" id="resetAll" role="button">清空</div>
                                    </div>
                                    <div class="rright" id="saveAll">
                                        保存权限
                                    </div>
                                </div>

                            </fieldset>
                        </div>

  • 相关阅读:
    userAgent判断当前设备类型
    h5+css3最简单的图片飞入以及淡入淡出效果
    ruby的form中常用的控件
    初识swipe.js
    后缀为7z的文件解码
    python all()函数
    flask web表单
    flask过滤器
    flask学习笔记1.21
    py学习笔记1.13、1.14
  • 原文地址:https://www.cnblogs.com/Resources-blogs/p/6604125.html
Copyright © 2020-2023  润新知