标签:
// 点击主页面的添加 跳转到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);
标签:
原文地址:http://www.cnblogs.com/youchim/p/5785386.html