• JS级联下拉框


    //Ajax级联获取SDK
    function GetDropDownList(parent_ddlID, fill_dllID, url, param) {
        this.pId = parent_ddlID;  //主下拉框name
        this.cId = fill_dllID;    //级联下拉框name
        this.URL = url;           //获取数据路径
        this.Paramer = param;     //参数
    }
    GetDropDownList.prototype.Inits = function (current) {
        var $ddl = $("select[name$=" + this.pId.toString() + "]");
        var $ddlSDKs = $("select[name$=" + this.cId.toString() + "]");
        $ddl.focus();
        $ddl.bind("change keyup", function () {
            if ($(this).val() != "0") {
                current.loadSDKList(current, $("select option:selected").val());
                $ddlSDKs.fadeIn("slow");
            } else {
                //$ddlSDKs.fadeOut("slow");
                $ddlSDKs.children("option").remove();
                $ddlSDKs.append($("<option></option>").val("0").html("不限"));
            }
        });
    }
    GetDropDownList.prototype.loadSDKList = function (current, selectedItem) {
        $.ajax({
            type: "get",
            url: this.URL,
            data: this.Paramer + "=" + selectedItem,
            dataType: "json",
            async: true,
            success: function (ret) {
                current.printSDKList(ret);
            }
        });
    }
    GetDropDownList.prototype.printSDKList = function (data) {
        $("select[name$=" + this.cId.toString() + "] > option").remove();
        for (var i = 0; i < data.length; i++) {
            $("select[name$=" + this.cId.toString() + "]").append(
                            $("<option></option>").val(data[i].Value).html(data[i].Text)
                       );
        }
    }

    //调用

    //var d = new GetDropDownList('主下拉框name', '级联下拉框name', '获取数据路径', '传递给调用路径的参数');
    //d.Inits(d);

    GetDropDownLis

  • 相关阅读:
    (dfs)codeforces 767C
    配置vscode c/c++像sublime那样按Ctrl+shift+B编译直接运行
    (JAVA)使用swing组件模仿QQ界面+网络编程实现QQ消息传输
    (dp)hihocoder
    (暴力+精度)hihocoder
    区域赛43天
    区域赛第33天
    区域赛41天
    最小和最大表示法
    HDU 6166 二进制划分集合
  • 原文地址:https://www.cnblogs.com/hucaihao/p/3554688.html
Copyright © 2020-2023  润新知