Click to See Complete Forum and Search --> : Popup Window - How Can I close this??


ss_learner
11-14-2005, 08:25 PM
Hi there,

Can anyone help me out!!

I have a small pop up window, which opens when i click a button in the asp page.

The pop up contains a form and after clicking submit on the pop up form, the values will be enterd into the database.
As of now, after I enter the values in the database, I display the status as "record inserted, click here to go close and after clicking the hyper link , the popup window gets closed and the parent form is refreshed..

But now, I want the window tobe closed automatically when clicking on the submit button .. of course, the values are to be inserted into database..
I dont know much about javascript..
I am pasting my javascript code here..

if success = 0 then
'refreshparent()%>
<HTML>
<HEAD>
<title>New Department</title>

<link href="../Css/StyleSheet.css" rel="stylesheet">
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY >
<center><b><font face="arial" >New Department has been added<br>
please click below to close the window</font></b><br><br><br><br>
<a href="add_dept.asp" class="menu_2" onclick="refreshparent()"; target="_top"><b>click here</b></a>
</font>
<%
'end if%>
<script language="javascript">
function refreshparent()
{
if(!window.opener.location)
window.opener.location = self;
window.opener.location.reload();
window.close();
self.close();
}
</script>
<!--</body>
</html>-->
<%
Response.End
end if
Thanks in advance
Regards

russell
11-14-2005, 08:55 PM
<%
main

Sub main()
' update the db here, then...
closeWin
End Sub

Sub closeWin()
%>
<script>
window.opener.location.reload();
self.close()
</script>
<%
End Sub
%>