Click to See Complete Forum and Search --> : control onunload page


jean-baptiste
03-07-2003, 05:28 PM
Hello,
When an user leaves the page that it is by "press back button" or "quit", the event "onUnload" is called and I call a server page via a form to pass parameters and that enables me "to kill the session".
My problem is that if an user submit normally the page with "submit" and well the event "onUnload" is called before the event "onsubmit".
Any ideas.
my code :
<html>
<head>
<script language="javascript">
function send() {
document.valide.submit();
}
function destroy() {
return document.control.submit();
}
</script>
</head>
<h1>TEST</h1>
<BODY onUnload="destroy()">

<FORM NAME ="valide" ACTION = "/servlet1" METHOD = "GET" onSubmit = return envoie()>
<input type="submit" value="" name=""/>
</form>
<FORM NAME ="control" ACTION = "/servlet2" METHOD = "GET" />
</BODY>
</HTML>

khalidali63
03-07-2003, 05:37 PM
just do this set a variable thats set to true when submit button is clicked and the in the destroy function use if statement
if (notTru){

}

hope this helps

Khalid

jean-baptiste
03-08-2003, 04:35 PM
Thank you, i don't know why i haven't thought of that!