-
Saving form values with JavaScript
I'm trying to add another field to a form on a site using Greasemonkey and save the value of whichever radio button is clicked.
Right now I have a "yes" and "no" button with the values 1 and 0.
I have a global variable in my script. formval = 1;
checkRadio() is a function to check which radio button is clicked.
When the user clicks submit, I want it do this: "formval = checkradio[0].value"
However, since at the top the global variable has formval = 1, each time the page is refreshed, formval will go back to 1. I want it to stay 0 if I click 0.
Does anyone have any help?
Last edited by itsjareds; 06-08-2008 at 07:42 PM.
-
-
http://www.htmlgoodies.com/beyond/ja...le.php/3470821
This is a pretty good tutorial on using cookies to save variables. Keep in mind that this also depends on the user...for instance, do they even have cookies enabled? Also, this is only saving the variable for said user....if another user views the site, it starts with the global declaration for them.
Verzeihung!
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks