Possible Duplicate:
Javascript global variable does not persist when navigate to another page (which also uses same js file)
I have a script
<script>
var pn=0;
function set()
{
pn=parseInt(pn)+1;
}
</script>
After the first execution of set
, pn
will be 1.
After the page is reloaded, pn
retains its value of 1
so on the next execution of set
it will be incremented to 2
.
How can I preserve global variables across page reloads?