I have a form and would like to pop-up a JavaScript alert reminding the user to click on
"save/update" before clicking on any other link/moving to the next page. The alert isn't
necessary if no changes were made on the page. Is this possible?
| SitePoint Sponsor |
I have a form and would like to pop-up a JavaScript alert reminding the user to click on
"save/update" before clicking on any other link/moving to the next page. The alert isn't
necessary if no changes were made on the page. Is this possible?





add onChange="setVar()" to all of your form elements, and onClick="return checkVar()" to all of your links.
Code:<script> <!-- changed = false; function setVar(){ changed = true; } function checkVar(){ if (changed) { alert("You need to save your data!"); return false; } return true; } //--> </script>
Bookmarks