Johnb21
01-05-2011, 01:39 AM
Is this possible? I am writing a script that will display an alert box that reads "your play was saved" after a user clicks the submit button on a form. The only problem is that after clicking save, the page refreshes. Here is the code I tried to use
function savedMessage(){
document.getElementById("CmdFinish").addEventListener("click",function(e) {
GM_setValue("Saved", 1); }, false);
if (GM_getValue("saved", 0) == 1) {
alert("Your play has been saved");
GM_setValue("saved", 0); // or GM_deleteValue("saved"); }
}
The button ID is "CmdFinish" and the value is "saved". Is there ANY way i can make the script run only on a page refresh?
**Note**
The script is for a specific page and not the whole site, so it wont run on every refresh on the site, only when it's needed on 1 page.
function savedMessage(){
document.getElementById("CmdFinish").addEventListener("click",function(e) {
GM_setValue("Saved", 1); }, false);
if (GM_getValue("saved", 0) == 1) {
alert("Your play has been saved");
GM_setValue("saved", 0); // or GM_deleteValue("saved"); }
}
The button ID is "CmdFinish" and the value is "saved". Is there ANY way i can make the script run only on a page refresh?
**Note**
The script is for a specific page and not the whole site, so it wont run on every refresh on the site, only when it's needed on 1 page.