【发布时间】:2017-02-08 19:34:44
【问题描述】:
我想打开一个报告页面,以便从登录它应该转到一个主页,该主页本身将在一个新窗口中打开。在主页上,有两个按钮。单击任何按钮,它将在新窗口中打开与该按钮关联的特定报告。
现在,问题是每个报告页面上都有一个链接应该返回到主页(即它应该最小化报告页面)。此外,如果用户再次打开第二个报告,它将在新窗口中打开并点击到主页的链接,它还应该最小化第二个报告窗口。
此外,在主页、第一份报告和第二份报告这 3 个页面上都有注销。因此,从主页单击注销应该关闭所有最小化的窗口(如果有)。从任何其他页面(即其他报告)单击注销时,它应该使会话无效。
我的问题是从第一次调用注销时我无法关闭第二个子窗口。此外,如果从主页调用注销,如何关闭所有弹出窗口。
我用来从登录打开主页的代码 -
function RedirectPage(path)
{
var intWidth = screen.width - 10; //Adjust for the end of screen
var intHeight = screen.height - 80; //Adjust for the Icon Bar at the bottom of the window.
var strWinProp = " toolbar=no" //Back, Forward, etc...
+ ",location=no" //URL field
+ ",directories=no" //"What's New", etc...
+ ",status=yes" //Status Bar at bottom of window.
+ ",menubar=no" //Menubar at top of window.
+ ",resizable=yes" //Allow resizing by dragging.
+ ",scrollbars=yes" //Displays scrollbars is document is larger than window.
+ ",titlebar=yes" //Enable/Disable titlebar resize capability.
+ ",width="+intWidth //Standard 640,800/788, 800/788
+ ",height="+intHeight //Standard 480,600/541, 600/566
+ ",top=0" //Offset of windows top edge from screen.
+ ",left=0" //Offset of windows left edge from screen.
+ "";
var win = window.open(path,'_blank',strWinProp);
self.setTimeout("closeMe()",500);
}
从主页打开报告的代码 -
function report1() {
sessionId = getURLParameters('requestID');
userName = getURLParameters('userName');
userId = getURLParameters('userId');
lvalue = getURLParameters('lValue');
lver = getURLParameters('lVer');
window.name = "parent";
var intWidth = screen.width - 10; //Adjust for the end of screen
var intHeight = screen.height - 80; //Adjust for the Icon Bar at the bottom of the window.
var strWinProp = " toolbar=no" //Back, Forward, etc...
+ ",location=no" //URL field
+ ",directories=no" //"What's New", etc...
+ ",status=yes" //Status Bar at bottom of window.
+ ",menubar=no" //Menubar at top of window.
+ ",resizable=yes" //Allow resizing by dragging.
+ ",scrollbars=yes" //Displays scrollbars is document is larger than window.
+ ",titlebar=yes" //Enable/Disable titlebar resize capability.
+ ",width="+intWidth //Standard 640,800/788, 800/788
+ ",height="+intHeight //Standard 480,600/541, 600/566
+ ",top=0" //Offset of windows top edge from screen.
+ ",left=0" //Offset of windows left edge from screen.
+ "";
window.open(Url + userName + "&requestID=" + sessionId + "&userId="
+ userId + "&lValue=" + lvalue + "&lVer=" + lver,'_blank',strWinProp);
}
我用于打开报告 2 的代码相同,只是我使用了不同的 URL。
点击从子节点注销时,我正在调用此函数 -
function logout()
{
opener.location.href = '/Login.html';
close();
}
第二个孩子使用相同的注销功能
主页退出功能-
function onLogout(){
window.opener.location.reload(true);
window.opener.location.href=loginPageUrl;
window.close();
}
【问题讨论】:
标签: javascript html logout window.open window.opener