&‘米粒

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 :: 管理 ::
//此代码放在主页面main.aspx脚本区域里
//
点击主页面的添加 跳转到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;//防止刷新页面 }

//主页面刷新方法 提供给子页面调用
function AddRefresh() //AddRefresh(id) 
{ 
 
//document.getElementById("ctl00_PageBody_Button2").click();//触发按钮的查询事件
 document.form1.submit(); 
}


 

//============JCXMUPDATE.aspx页面 子页面===============================

<input onclick="javascript: window.close();" id="Reset1" class="button" type="button" value="关闭">


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

 

posted on 2016-08-18 21:04  youchim  阅读(1392)  评论(0)    收藏  举报