Clicking your submit button will submit the form, meaning it will submit it to whatever is in the action attribute of your form tag. So your action attribute calls the JavaScript the pops up the alert box with 'submit me' in it.

When you close the window, the onUnload attribute of the body tag gets called, and your onUnload attribute calls the JavaScript funtion callme() which pops up an alert box with the text "gonna submit form" in it.

Rajeev Ravindran
Ranch Hand

Joined: Aug 27, 2002
Posts: 455

posted Aug 16, 2005 11:11:00

0

hey Stephen , thanks for the reply !!

Just to figure out watz happening there, i invoked a servlet on form submit and i found its too inconsistent. Sometimes when i close the browser window tat servelt is getting invoked sometimes its not !!

What i really need is , i want to a servlet to be executed whenever i close the window but when i dont want the servlet to execute if i refresh the window.. any help on this is highly appretiated.. i have spend a lot of time on this.. i dont trust calling js funtion onUnload() and checking clientX and clientY position, it sometimes works properly on IE + Win XP but the same wasnt working on IE + Win 2000.. any tips or tricks ?