Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

popup in small window is not closing automatically

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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>
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When the window closes it removes all of the variable references. So on the next page load it does not exist.

Eric
 
Ew. You guys are ugly with a capital UG. Here, maybe this tiny ad can help:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic