Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Do not unload

Status
Not open for further replies.

ratcho

Programmer
Joined
Jul 25, 2002
Messages
3
Location
CA
Hi guys,

Please help me with the following problem.

I want to stay on the page if some conditions are false. For exemple:

Sub Window_OnBeforeUnLoad()
if not bResultSave then
'Cancel UnLoad
end if
End Sub

How should I do this?
Any help is highly appreciated.
 
This works in IE:
In the <BODY> tag:<body OnUnload=&quot;DoStuff()&quot;>
Then have a subroutine that let's the user know what the problem is (or whatever you want):

<script language=&quot;VBscript&quot;>
Sub DoStuff()
alert &quot;Hey, you forgot to do whatever&quot;
window.navigate &quot;thispage.asp&quot; 'Whatever your pagename is - keep them here
End Sub
</script>

Instead of an alert you could use a messagebox and do different things based on the response.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top