How to save Javascript variable between frames?

I have a javascript variable called "myvar" in two different frames (frame1 and frame2). I need to take myvar in frame1 and set it as myvar value in frame2. How to do this without an external script?

+5
source share
1 answer

If the variable is in the parent, use:

window.parent.varName

If it is in another frame, go through the parent element and then into the frame:

window.parent.frameName.varName
+10
source

All Articles