Codesupplier.com

free html codes for your website

Confirmation on Departure of Page

If you have a database that users can delete information from, this Javascript Code is very useful for checking that the user actually wishes to delete the information. The Javascript works by using the phrase "return confirm". If you just placed "return confirm" on it's own nothing would happen, so we need to tell the browser what to do. On click a pop up will appear asking the user if they wish to leave the page or if they wish to stay. If the user clicks stay the browser will know not to leave the page and therefore keep the information, so it would not be deleted. But if the user clicks submit and leave the information in the database would be deleted. This Javascript Code is useful for many other applications as well as databases. 

If you would like to use this Javascript Code please copy and paste the below code and change to parts in red to suit you...

Click here for an example.

<a href=http://www.codesupplier.com/ onclick="javascript:return confirm('Are you sure you want to return to Codesupplier Home?')"><BR>
Click here to return home page of Codesupplier.com</a>

< Go Back to Javascript Snippets