View Full Version : OK i have a simple question

07-16-2004, 07:26 AM
Ok i have a simple JavaScript question: :cool:

I want to create a variable on page 1 (page1.html)
Which has a value of 66

On the second page, i want it to keep that variable, and print it's value.

How can i make that variable "stay" in memory?

07-16-2004, 07:36 AM

07-16-2004, 07:36 AM
I'm such an ignorant self-taught life-time-novice that this is the blind leading the blind, but I'll take a stab at it.

To the best of my knowledge when you load a new page you lose everything in memory. There are two workarounds that I know of:

1. Save the variable from page one in a cookie which is loaded by page two.
2. Don't actually change the "page" but give that illusion by rewritting it using frames. See my recent posts on the subject.



Edit to the above... glenngv and I posted almost exactly the same time. Looking at his ref I didn't do so bad!

Willy Duitt
07-16-2004, 02:10 PM
Or for sessions you can pass your variable on the window.name property....

Page One:
window.name = 66; // or your variable //;

Page Two: