我是jsps / javascript的新手,所以如果问题很愚蠢请耐心。我已经护目镜但是找不到答案。我必须单击一次按钮打开弹出窗口,显示报告并刷新父页面。但现在pop被最小化,父页面出现在前面。下面是代码。
function bustOut()
{
window.location.href="<%=request.getContextPath()%>/viewer/faces/faults/logViewer.jsf";
var sessionId = "LR<%=session.getId()%>";
var url="<%=request.getContextPath()%>/viewer/faces/faults/logReport_popup.jsf";
popupwindow=window.open(url,sessionId,"height=730,width=745,scrollbars=1,resizable=1,top=500");
popupwindow.focus();
}
当我删除window.location.href时,我的弹出窗口显示在前面,但父页面变为空白。 我想弹出窗口不应该被最小化。谢谢
答案 0 :(得分:0)
使用类似的东西:
function bustOut()
{
//no need to set href again...
var sessionId = "LR<%=session.getId()%>";
var url="<%=request.getContextPath()%>/viewer/faces/faults/logReport_popup.jsf";
popupwindow=window.open(url,sessionId,"height=730,width=745,scrollbars=1,resizable=1,top=500");
//reload current window after popup opens..wait for 1000ms or 2000ms..
//reload happens after 1s as per below code...
window.setTimeout("window.location.reload();", 1000);
}