Forum Moderators: open
Please, advise what I have to put in the second code
to close the site.
response.write("<script language=""Javascript"">")
response.write("window.close();")
response.write("</script>")
Note, if the window wasn't opened as a pop up, then you'll get a javascript prompt saying something to the effect of "A program is trying to close this window, do you accept?"
HTH,
JP
Your suggestion works, with small changes.
The code you suggested clears the frame
where an exit button is placed in the frame.
I changed it to parent.close() or
top.close(), and now it clears the frame first
and then closes the window prompting the user.
See code below.
How to avoid the clearing the frame?
<%
if session("loggedin") = true then
session("loggedin") = false
session("username") = ""
session("email") = ""
session("alias") = ""
session("personalid") = ""
response.write("<script language=""Javascript"">")
response.write("top.close();")
response.write("</script>")
else
response.write("<script language=""Javascript"">")
response.write("top.close();")
response.write("</script>")
end if
%>
erenshte
if rs.eof then
response.redirect "login.asp?error=1"
%>
<!-- #include file="dbconnclose.asp" -->
<%
else
session("loggedin") = true
session("personalid") = rs("PersonalID")
session("alias") = rs("Alias")
session("username") = rs("Username")
SQL = "UPDATE Personal SET TimesLoggedIN = TimesLoggedIn + 1, LastLogin = Now() WHERE Alias = '" & session("alias") & "'"
response.redirect "buildmain.htm"
set ps = cn.execute(SQL)
ps.close
set ps = nothing
rs.close
set rs = nothing
end if
%>
in the login.asp file I have a login form with the following line:
<form name="form1" method="post" target="_top" action="login_proc.asp">
which opens buildmain.htm form log_proc on the
_top window if login is correct
If user makes mistake the login form is displayed
again and id should be displayed at the same
frame as before. There is an initial link from the
manu that opens login form in one of three frames,
let's call main2.
If I change target in the line above to "_self"
it solves the problem, but then buildmain.htm
opens at the same frame too.
I'm stacked with this small and possible easy
solvable problem.
Please, help
erenshte