File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes popup in small window is not closing automatically Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "popup in small window is not closing automatically" Watch "popup in small window is not closing automatically" New topic
Author

popup in small window is not closing automatically

shashi bhushans
Greenhorn

Joined: May 12, 2011
Posts: 17
Hi Guys,
I attached screen shot of "loading please wait" msg. If i click on Report section(marked circle in screenshot) I used javascript for loading please wait msg in small window popup. after few secs it has to close popup window but it is not closing automatically. please see following code used for loading please wait:

see javascript function fnBeforeUnload() & function fnOnLoad()

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>


<%@page import="in.gov.mrc.kstd.arch.util.WEBKEYS"%>
<%@page import="in.gov.mrc.kstd.business.ApplicationUser"%>
<%@page import="in.gov.mrc.kstd.arch.util.IMRCConstants"%><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>KSTD</title>
</head>
<script language="javascript">
var reportFlag;
var msgWindow;
function fnOpenAbout()
{
window.open("about.html", '',"left=300,top=200,width=400,height=250,status=no,scrollbars=no,toolbar=no0,location=no,menubar=no");
}
function fnBeforeUnload()
{
if(reportFlag=='report')
{
var url="/CMSMTDP/Wait.html";
var width = 100;
var height = 100;
var name = "Loading";
var sw=screen.width-20;
var sh=screen.height;
var positionleft=(sw-width)/2;
var positiontop=(sh-height)/2.5;
var day = new Date();
var id = day.getTime();
var options = "toolbar=no,scrollbars=yes,resizable=no,width="+width+",height=" + height;
msgWindow=window.open(url,id,options);
msgWindow.focus();
for(width1 = 1 ; width1 < positionleft ; width1 = width1 + 10);
msgWindow.moveTo(width1,positiontop)
}

}
function fnOnLoad()
{

if(msgWindow && typeof msgWindow!='undefined')
msgWindow.close();
}

function fnGenerateReport(url)
{
reportFlag='report';
document.location.href=url;
}
</script>
<body onload="fnOnLoad()" onBeforeUnload="fnBeforeUnload()">
<table align="left"><tr><td align="left">
<%if(session.getAttribute("changepassword")==null){%>

<%
ApplicationUser applicationUser=(ApplicationUser)session.getAttribute(WEBKEYS.USER_DETAILS);
if(applicationUser!=null && applicationUser.getRoleId()==IMRCConstants.IT_STAFF)
{

%>



<div><span style="width:100;text-align:left"><b><u><font size="2">Grant Allocation</font></u></b></span> </div>
<div>
<div><a href="/CMSMTDP/createGrant.do?dispatch=grantCreate" style="width:100;text-align:left">Create</a></div>
<div><a href="/CMSMTDP/fetchOrder.do?dispatch=fetchOrder" style="width:100;text-align:left">Update</a></div>
<div><a href="/CMSMTDP/fetchCorrectGrantDetails.do?dispatch=fetchOrder" style="width:100;text-align:left">Correct</a></div>
</div>

<br>
<div><span style="width:100;text-align:left"><b><u><font size="2">Action Plan</font></u></b></span> </div>
<div>
<div><a href="/CMSMTDP/createActionPlan.do?dispatch=actionCreate" style="width:100;text-align:left">Create</a></div>
<div><a href="/CMSMTDP/fetchApprovalNo.do?dispatch=fetchApproval" style="width:100;text-align:left">Update</a></div>
<div><a href="/CMSMTDP/fetchCorrectActionPlanDetails.do?dispatch=fetchApproval" style="width:100;text-align:left">Correct</a></div>
</div>
<br>
<div><span style="width:100;text-align:left"><b><u><font size="2">Release Details</font></u></b></span> </div>
<div>
<div><a href="/CMSMTDP/createRelease.do?dispatch=releaseCreate" style="width:100;text-align:left">Create</a></div>
<div><a href="/CMSMTDP/fetchReleaseNo.do?dispatch=fetchReleaseNo" style="width:100;text-align:left">Update</a></div>
<div><a href="/CMSMTDP/fetchCorrectReleaseDetails.do?dispatch=fetchReleaseNo" style="width:100;text-align:left">Correct</a></div>
</div>
<br>
<!-- input type=button value="Work Detail" onclick="loadMainFrame(this)" style="width:100;font-weight:bold; background-color:pink;" -->
<div><span value="Work Detail" onclick="" style="width:100;text-align:left" ><b><u><font size="2">Work Detail</font></u></b></span></div>

<div>
<div><a href="/CMSMTDP/createWorkDetails.do?dispatch=workDetailCreate" style="width:100;text-align:left">Create</a></div>
<div><a href="/CMSMTDP/updateWorkDetails.do?dispatch=updateWorkDetails" style="width:100;text-align:left" >Update</a></div>
<div><a href="/CMSMTDP/correctWorkDetails.do?dispatch=updateWorkDetails" style="width:100;text-align:left" >Correct</a></div>

</div>
<br>
<div>

<div><a href="#" onclick="fnGenerateReport('/CMSMTDP/fetchExpenditureDetails.do?dispatch=expenditureUpdate')" style="width:100;text-align:left"><b><u>Expenditure Updation</u></b></a></div>
</div>

<br>
<%
}
%>
<div><span style="text-align:left"><b><u><font size="2">Reports</font></u></b></span> </div>
<div><a href="/CMSMTDP/DistrictReport.do" style="width:100;text-align:left" >Geographic Abstract Report</a></div>
<div><a href="#" onclick="fnGenerateReport('/CMSMTDP/generateAbstractReport.do?dispatch=fetchDistrict')" style="width:100;text-align:left">Abstractreport</a></div>
<div><a href="#" onclick="fnGenerateReport('/CMSMTDP/generateWorkSummaryReport.do?dispatch=fetchUlb')" style="width:100;text-align:left">Worksummaryreports</a></div>
<div><a href="#" onclick="fnGenerateReport('/CMSMTDP/fetchWorkDetailsReport.do?dispatch=workDetailReport')" style="width:100;text-align:left">WorkDetails</a></div>
<div><a href="#" onclick="fnGenerateReport('/CMSMTDP/generateDeletedWorkSummaryReport.do?dispatch=fetchUlb')" style="width:100;text-align:left">DeletedWorkSummaryreports</a></div>
<div><a href="#" onclick="fnGenerateReport('/CMSMTDP/generateDeletedWorkSummaryReport.do?dispatch=passwordReport')" style="width:100;text-align:left">PassWordExpiryreports</a></div>
<div><a href="#" onclick="fnGenerateReport('/CMSMTDP/generateWorkwiseProgressReport.do?dispatch=fetchUlb')" style="width:100;text-align:left">WorkwiseProgressreports</a></div>


<br>
<%

if(applicationUser!=null && applicationUser.getRoleId()==IMRCConstants.MRC_ADMIN)
{
%>

<div>
<div><span style="text-align:left"><b><u><font size="2">Administrator</font></u></b></span> </div>
<div><a href="#" onclick="fnGenerateReport('/CMSMTDP/retrieveWorkDetails.do?dispatch=workDetailReport')" style="width:100;text-align:left">Retrive Works</a></div>
</div>

<div>
<br>
<div><span style="text-align:left"><b><u><font size="2">Delete</font></u></b></span> </div>
<div><a href="#" onclick="fnGenerateReport('/CMSMTDP/fetchWorkDetailsReport.do?dispatch=deleteworkDetails')" style="width:100;text-align:left">Works</a></div>
<%
}
%>
</div>
<div>
<br>
<hr>
<%
if(applicationUser!=null && (applicationUser.getRoleId()==IMRCConstants.IT_STAFF || applicationUser.getRoleId()==IMRCConstants.MRC_ADMIN))
{
%>
<div><span style="text-align:left"><b><u><font size="2">User</font></u></b></span> </div>
<% } %>
<%
if(applicationUser!=null && applicationUser.getRoleId()==IMRCConstants.MRC_ADMIN)
{
%>

<div><a href="/CMSMTDP/uploadWorkDetails.do?dispatch=fetchUploadWorkDetail" style="width:100;text-align:left" >Upload</a></div>
<div><a href="/CMSMTDP/createUser.do?dispatch=fetchCreateUserDetails" style="text-align:left">Create User</a></div>
<div><a href="/CMSMTDP/changePasswordAdmin.do?dispatch=changePasswordFetchDetails" style="text-align:left">Reset Password</a></div>

<%
}
else if(applicationUser!=null && applicationUser.getRoleId()==IMRCConstants.IT_STAFF)
{
%>

<div><a href="/CMSMTDP/fetchChangePassword.do" style="text-align:left">Change Password</a></div>
<br style="line-height:5px"/>
<%
}
%>

</div>
<br>
<div><a href=#" onclick="fnOpenAbout()" style="width:100;text-align:left">About</a></div>
<%} else{%>
<%
ApplicationUser applicationUser=(ApplicationUser)session.getAttribute(WEBKEYS.USER_DETAILS);
if(applicationUser!=null && applicationUser.getRoleId()==IMRCConstants.IT_STAFF)
{
%>
<div><span style="width:100;text-align:left"><b><u><font size="2">Grant Allocation</font></u></b></span> </div>
<div>
<div><a href="#" style="width:100;text-align:left">Create</a></div>
<div><a href="#" style="width:100;text-align:left">Update</a></div>
<div><a href="#" style="width:100;text-align:left">Correct</a></div>
</div>

<br>
<div><span style="width:100;text-align:left"><b><u><font size="2">Action Plan</font></u></b></span> </div>
<div>
<div><a href="#" style="width:100;text-align:left">Create</a></div>
<div><a href="#" style="width:100;text-align:left">Update</a></div>
<div><a href="#" style="width:100;text-align:left">Correct</a></div>
</div>
<br>
<div><span style="width:100;text-align:left"><b><u><font size="2">Release Details</font></u></b></span> </div>
<div>
<div><a href="#" style="width:100;text-align:left">Create</a></div>
<div><a href="#" style="width:100;text-align:left">Update</a></div>
<div><a href="#" style="width:100;text-align:left">Correct</a></div>
</div>
<br>
<!-- input type=button value="Work Detail" onclick="loadMainFrame(this)" style="width:100;font-weight:bold; background-color:pink;" -->
<div><span value="Work Detail" onclick="" style="width:100;text-align:left" ><b><u><font size="2">Work Detail</font></u></b></span></div>

<div>
<div><a href="#" style="width:100;text-align:left">Create</a></div>
<div><a href="#" style="width:100;text-align:left" >Update</a></div>
<div><a href="#" style="width:100;text-align:left" >Correct</a></div>

</div>
<br>
<div>

<div><a href="#" style="width:100;text-align:left"><b><u>Expenditure Updation</u></b></a></div>
</div>

<br>
<%
}
%>
<div><span style="text-align:left"><b><u><font size="2">Reports</font></u></b></span> </div>
<div><a href="#" style="width:100;text-align:left" >Geographic Abstract Report</a></div>
<div><a href="#" style="width:100;text-align:left">Abstractreport</a></div>
<div><a href="#" style="width:100;text-align:left">Worksummaryreports</a></div>
<div><a href="#" style="width:100;text-align:left">WorkDetails</a></div>
<div><a href="#" style="width:100;text-align:left">DeletedWorkSummaryreports</a></div>
<div><a href="#" style="width:100;text-align:left">PassWordExpiryreports</a></div>
<div><a href="#" style="width:100;text-align:left">WorkwiseProgressreports</a></div>
<br>
<%

if(applicationUser!=null && applicationUser.getRoleId()==IMRCConstants.MRC_ADMIN)
{
%>

<div>
<div><span style="text-align:left"><b><u><font size="2">Administrator</font></u></b></span> </div>
<div><a href="#" style="width:100;text-align:left">Retrive Works</a></div>
</div>

<div>
<br>
<div><span style="text-align:left"><b><u><font size="2">Delete</font></u></b></span> </div>
<div><a href="#" style="width:100;text-align:left">Works</a></div>
<%
}
%>
</div>
<div>
<br>
<hr>
<div><span style="text-align:left"><b><u><font size="2">User</font></u></b></span> </div>
<%
if(applicationUser!=null && applicationUser.getRoleId()==IMRCConstants.MRC_ADMIN)
{
%>

<div><a href="#" style="width:100;text-align:left" >Upload</a></div>
<div><a href="#" style="text-align:left">Create User</a></div>
<div><a href="#" style="text-align:left">Reset Password</a></div>

<%
}
else
{
%>

<div><a href="#" style="text-align:left">Change Password</a></div>
<%
}
%>
<br style="line-height:5px"/>
</div>
<br>
<div><a href="#" style="width:100;text-align:left">About</a></div>


<%} %>


</td></tr></table>
</body>
</html>
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
When the window closes it removes all of the variable references. So on the next page load it does not exist.

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: popup in small window is not closing automatically
 
Similar Threads
jQuery not working on page
Error comes whilke compiling the jsp page
white-space nowrap and DOCTYPE
Google use Javascript or ajax on first page?
Pagination Problem