Possible Duplicate:
How do I stop a page from unloading (navigating away) in JS?
Prompt user for unsaved changes when leaving webpage
I have a php form which i designed in dreamweaver containing only text fields, which retrieves a single record at a time from my database. I have on this page also an 'update record' button which when clicked updates the database record with any changes that was made to the data in the form. I want that if a user edits form data in some way and tries to leave the page without clicking the 'update record' button, that they would be prompted that the page contains unsaved changes and they would be asked to verify if they want to leave or not (maybe via some javasript if possible).
Any help is much appreciated.