layer使用

$("#btnSelectEnterprise").bind("click", function() {
            //弹出层
            top.layer.open({
                title: "选择",
                type: 2,
                content: '@Url.Action("ChoiceEnterprise")?EnterpriseList=' + $("#EnterpriseList").val(),
                area: ['500px', '545px'],
                fix: false,
                maxmin: false,
                btn: ['确定', '取消'],
                success: function (layero, index) {
                },
                yes: function (index, layero) {
                    var choosedEnterpriseName = "";
                    var choosedEnterpriseId = "";
                    var body = top.layer.getChildFrame('body', index);
                    var selControl = body.contents().find("#selChoosedEnterprise option");
                    $(selControl).each(function (k, v) {
                        if (k != selControl.length-1) {
                            choosedEnterpriseName += $(this).text() + ",";
                            choosedEnterpriseId += $(this).val() + ",";
                        } else {
                            choosedEnterpriseName += $(this).text();
                            choosedEnterpriseId += $(this).val();
                        }
                    });
                    $("#EnterpriseName").val(choosedEnterpriseName);
                    $("#EnterpriseList").val(choosedEnterpriseId);
                    top.layer.close(index);
                }
            });
        });

官网地址:http://layer.layui.com/

posted @ 2017-11-03 08:45  事理  阅读(183)  评论(0编辑  收藏  举报