zoukankan      html  css  js  c++  java
  • 多个iframe,删除详情页时刷新同级iframe的table list

    说明:在使用iframe开发时,经常遇到多个iframe之间的操作。

    下面就是一个需求:在一个iframe中关闭时,刷新指定的iframe;

    添加需要刷新的标识reload=true 

    //添加npi2mp时,刷新NPI2MPTable 
    $(top.document).find("iframe").each(function () {
        if ($(this).data("id") == "npi/showNPI2MPTable") {
            $(this).attr("reload", "true");
            return;
        }
    });
    
    //删除时做同样的操作即可

    然后再切换tab的操作中做判断是否需要刷新操作

    //切换tab
    function e() {
        if (!$(this).hasClass("active")) {
            var bRefresh = false; // 是否需要刷新
            var tabName = $(this).text().trim();
            // 解决128 & 131 issue ,新增NPI轉MP时候不用刷新页面 by robert
            if (tabName == "新增NPI轉MP") {
                bRefresh = false;
            }
            //切换tab时判断是否需要刷新            
            if (tabName == "NPI轉MP") {
                $(top.document).find("iframe").each(function () {
                    if ($(this).data("id") == "npi/showNPI2MPTable") {
                        if ($(this).attr("reload")) {
                            bRefresh = true;
                        } else {
                            bRefresh = false;
                        }
                        $(this).removeAttr("reload");
                        return;
                    }
                });
            }
            var k = $(this).data("id");
            $(".J_mainContent .J_iframe").each(function () {
                if ($(this).data("id") == k) {
                    //根据前面的判断,那些需要刷新
                    if (bRefresh) {
                        this.src = this.src; // 点击时刷新frame
                    }
                    $(this).show().siblings(".J_iframe").hide();
                    return false;
                }
            });
            $(this).addClass("active").siblings(".J_menuTab").removeClass("active");
            g(this);
        }
    }
    $(".J_menuTabs").on("click", ".J_menuTab", e);

     

  • 相关阅读:
    python求3的倍数与和
    linux内核优化参数
    ssh 调优参数
    mysql xtarbackup备份脚本
    mysql全库备份数据库脚本
    python json模块
    python函数介绍
    字典常用操作
    python常用字符串操作
    最好的10本适用于初学者阅读的javaScript和jQuery书籍
  • 原文地址:https://www.cnblogs.com/gqzdev/p/11936220.html
Copyright © 2011-2022 走看看