Possible Duplicate:
Persist javascript variables across pages?
how to exchange variables between two html pages
I am working on creating a “quiz” that allows users to answer questions, then passes their answer and current score to the next page for the next question. I used this article and was able to get the user’s answer to pass through to the next window:
The issue is that this passes the information through a form. Once I receive the score on the second page, I need to increment the score if the answer was correct. I can’t figure out how to pass a javascript variable with an html form.
I feel like this should be a relatively easy fix, I’m just stumped.
Any thoughts or advice would be much appreciated!
xoxo
There are two obvious ways to maintain state in the browser without requiring that the server remember it between pages:
Cookies
localStorageThe latter is trivial to implement, but is only available in HTML5.
Note that neither is intended to be secure – a determined page hacker could set either to whatever value they wish.