码迷,mamicode.com
首页 > Web开发 > 详细

js 弹出子页面刷新父页面

时间:2016-08-18 23:20:44      阅读:276      评论:0      收藏:0      [点我收藏+]

标签:

// 点击主页面的添加 跳转到JCXMUPDATE页面
function AddNewData() {
          
                //居中显示
                var Url = "JCXMUPDATE.aspx?action=" + actionmethod;
                var height = 280;
                var width = 600;
                var win = OpenWin(Url, height, width, "no");
                win.focus(); //使弹出的页面得到焦点
                return false; //防止刷新页面
          
            }

//弹出页面
function OpenWin(Url, height, width) {
    var top = (screen.availHeight - height) / 2;
    var left = (screen.availWidth - width) / 2;
    var title = Url.split(‘.aspx‘)[0].replace("..", "");
    if (title.indexOf(‘/‘) != -1) {
        var begin = title.lastIndexOf(‘/‘);
        sTitle = title.substr(begin + 1, title.length - begin); //文件名
        title = sTitle;
    }
    var win = window.open(Url, title, ‘height=‘ + height + ‘, width=‘ + width + ‘,top=‘ + top + ‘,left=‘ + left + ‘,  toolbar=no, menubar=no, scrollbars=yes, resizable=yes,location=no, status=no‘);
    return win; //使弹出的页面得到焦点
    //return false;//防止刷新页面
}

 

//===========================================
//子页面关闭
  window.onbeforeunload = function () {
                if (window.opener != null) {
                    //window.opener.AddRefresh();
                    closeWin();
                }
            }
 function closeWin() {
  hasClosed = true;
  window.opener.location = "javascript:AddRefresh();";
//传参数 "javascript:AddRefresh("+1+");";
  window.opener = null; window.close();
}
//主页面刷新 //刷新 function AddRefresh() //AddRefresh(id) 带参数 给父页面传参数 { //alert(id); //document.getElementById("ctl00_PageBody_Button2").click(); document.form1.submit(); }
//子窗口获取父窗口的值
var text= window.opener.document.getElementById("TextBox1").value;
alert(text);

 

js 弹出子页面刷新父页面

标签:

原文地址:http://www.cnblogs.com/youchim/p/5785386.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!