layer弹窗 获取frames的值

4250人阅读 2021/3/17 15:34 总访问:651800 评论:0 收藏:0 手机
分类: Jquery

通过window.frames["name"]可以调用layer弹页窗指向页面的方法

 //例如目标页面存在一个方法
 var update = function ()
 {
     alert("hello");
 }

弹窗主页面调用

 window.frames["name"].update()

注意:layer弹窗生成的盒子每一次生成的名字都不同,所以名字需要是动态的

  layer.open({
            title: '修改',
            skin: 'layui-layer-lan',
            area: ['470px', '280px'],
            btn: ['确定', '取消'],
            type: 2,
            content: "目标页面",
            yes: function myfunction(index) {
                    //index表示弹窗次数
                window.frames["layui-layer-iframe" + index].update();
                
                
                });
                
                 //关闭所有layer
                layer.closeAll();
            },



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