博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
JQuery 进入页面默认给已赋值的复选框打钩
阅读量:6325 次
发布时间:2019-06-22

本文共 2656 字,大约阅读时间需要 8 分钟。

    效果

    

    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="width: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>

转载于:https://www.cnblogs.com/Resources-blogs/p/6604125.html

你可能感兴趣的文章
构建无障碍 React Native 应用
查看>>
Flutter常用Widget详解(二)
查看>>
JavaSE基础:数组
查看>>
MarkDown自动生成目录(文章开头或者侧边目录)
查看>>
RxSwift 之 Observable
查看>>
互联网广告的背后是什么(3):今日头条DSP的基本信息和主要特点
查看>>
vimium
查看>>
我们的GIT工作流
查看>>
原型继承(翻译 vjeux 文章)
查看>>
部分 Android 手机硬压视频和 IOS 播放器不兼容的问题
查看>>
git常用命令
查看>>
JPA关系映射系列四:many-to-many 关联映射
查看>>
资产配置的难题,要靠一线城市的价值洼地解决?
查看>>
《The Startup Way》作者访谈
查看>>
青雀推出小程序服务矩阵 助企业抢占首波移动先机
查看>>
Flask 插件系列 - Flask-SQLAlchemy
查看>>
php const define 区别
查看>>
webpack实践笔记(三)--- 总结
查看>>
一、WebGL——着色器和绘制
查看>>
ES6-Promise
查看>>