Hi, I am assuming user use IE browser which supports Javascript. I want my LogoutServlet to run when the user pushes the logout button or close the browser. Here is my code, but my
servlet will not get executed, my browser closes ok(I want the browser to close when the user logout), why is this? When I remove the "window.close();" line, my servlet will execute, is it because my window closes too quickly before it submits the form?
< script language = "javascript">
function logOut()
{
window.event.returnValue = false;
if(confirm("logout�H")){
window.event.returnValue = true;
window.close();
}
}
/script
< p
align="center"> < input type="submit" value="logout" action="http/myhost/Servlet/LogoutServlet"
"onclick"="logOut()"> //I put an extra quotation here because otherwise I could not submit this message to Javaranch, strange.
< /p>
Also, can someone explain the "onclose()" function to me? How do I submit a request to the servlet using only Javascript? something like:
Window.onclose(){
Document.myform.submit();
} /
???
Thanks!