zoukankan      html  css  js  c++  java
  • 无题

        <script src="../js/jquery-1.4.2.min.js" type="text/javascript"></script>
        <script type="text/javascript">
            function showDiv(ids) {
                var dis = $("#" + ids).attr("dis");
                var div = $("#div" + dis);
                var towhere = $("#"+ids).attr("jj");
                if (div.is(":visible")) {
                    div.hide();
                }
                else {
                    div.show();
                }
                //bind events
                if (!div.data("hasbind")) {
                    div.find(":checkbox").click(function () {
                        var txt = $(this).next().text();
                        if (txt == "任意") {
                            div.find(":checkbox").slice(1).attr("checked", false);
                            div.find(":checkbox:first").attr("checked", true);
                            $("#" + towhere).val($(this).attr("checked") ? txt : "");
                            return;
                        }
                        else if (div.find(":checkbox:checked").length == div.find(":checkbox").length - 1) {
                            div.find(":checkbox").slice(1).attr("checked", false);
                            div.find(":checkbox:first").attr("checked", true);
                            $("#" + towhere).val("任意");
                            return;
                        }
                        else {
                            div.find(":checkbox:first").attr("checked", false);
                        }
                        var arr = [];
                        div.find(":checkbox:checked").each(function () {
                            arr.push($(this).next().text());
                        });
                        $("#" + towhere).val(arr.join(','));
                    });
                    div.data("hasbind", true);
                }
            }
            $(document).ready(function () {
                //            $("#marriage_con").click(function () {
                //                var dis = $(this).attr("dis");
                //                var div = $("#div" + dis);
                //                var towhere = $(this).attr("jj");
                //                if (div.is(":visible")) {
                //                    div.hide();
                //                }
                //                else {
                //                    div.show();
                //                }
                //                //bind events
                //                if (!div.data("hasbind")) {
                //                    div.find(":checkbox").click(function () {
                //                        var txt = $(this).next().text();
                //                        if (txt == "任意") {
                //                            div.find(":checkbox").slice(1).attr("checked", false);
                //                            $("#" + towhere).val($(this).attr("checked") ? txt : "");
                //                            return;
                //                        }
                //                        else if (div.find(":checkbox:checked").length == div.find(":checkbox").length - 1) {
                //                            div.find(":checkbox").slice(1).attr("checked", false);
                //                            div.find(":checkbox:first").attr("checked", true);
                //                            $("#" + towhere).val("任意");
                //                            return;
                //                        }
                //                        else {
                //                            div.find(":checkbox:first").attr("checked", false);
                //                        }

                //                        var arr = [];
                //                        div.find(":checkbox:checked").each(function () {
                //                            arr.push($(this).next().text());
                //                        });
                //                        $("#" + towhere).val(arr.join(','));
                //                    });
                //                    div.data("hasbind", true);
                //                }
                //            });
            });
          
        </script>

  • 相关阅读:
    2020年勒索软件攻击最多的四大漏洞
    物联网时代,我们还能有哪些隐私?
    区块链技术最重要价值所在
    为什么云遣返不仅仅是从公共云回到内部部署环境
    如何应对越来越多的物联网勒索软件威胁?
    如何将边缘计算与核心系统集成
    莫唱衰:5G开局很快,但原力呈现才刚刚开始
    云原生架构支撑千万级DAU游戏
    变革型AI、无代码与低代码——哪一种才是企业AI部署的理想途径?
    nginx代理的配置和文件访问权限配置
  • 原文地址:https://www.cnblogs.com/caishuowen/p/2121990.html
Copyright © 2011-2022 走看看