layer弹窗

2882人阅读 2020/12/30 17:38 总访问:676525 评论:0 收藏:0 手机
分类: AJAX
//先引入layer的js

layer.open({
                                //属性
                type:1,
                //标题
                title: "内容修改",
                //content(正文)可传obj,可传字符串,可传html
                content: $("#hid"),  //传入隐藏域的对象
                //宽度,高度
                area: ["500px", "300px"],
                //按钮
                btn: ["确定", "取消"],
                //样式
                 skin: 'layui-layer-lan',
                //确定事件
                yes: function myfunction(index,layero) {
                  //alter (单击确定触发)
                        })
                btn2 : function myfunction(index,layero) {
                  //alter (单击第二个按钮触发)
                        })
                        
                    //关闭弹窗
                    layer.close(index)
            })


给layer中的属性赋值(找到隐藏域中的属性赋值)

$("#Sid").val($(this).parents("tr").find("td").eq(1).text())

取出layer中的值(找到隐藏域中的值)

$("#Sid").val();


关闭layer

                //关闭当前index;
                layer.close(index);
                //关闭所有layer 
                layer.closeAll();
                //layer.closeAll('dialog'); //关闭信息框
                //layer.closeAll('page'); //关闭所有页面层
                //layer.closeAll('iframe'); //关闭所有的iframe层
                //layer.closeAll('loading'); //关闭加载层
                //layer.closeAll('tips'); //关闭所有的tips层

layey中type属性不正确会导致第二次layer弹窗打不开


layer中5种类型传入的值有:0(信息框,默认是0),1(页面层),2(iframe层),3(加载层),4(tips层)


评价
脚踏实地,一步一个脚印
排名
6
文章
6
粉丝
16
评论
8
{{item.articleTitle}}
{{item.blogName}} : {{item.content}}
ICP备案 :渝ICP备18016597号-1
网站信息:2018-2024TNBLOG.NET
技术交流:群号656732739
联系我们:contact@tnblog.net
欢迎加群交流技术