Reputation: 109
Let's say I declared the variable var = 5;
in frame1. Now how do I pass this variable to frame2? I'd like to pass it using a hyperlink. Are there any other ways to do that?
Also, how do I access that variable after passing to frame2 in frame2?
Upvotes: 0
Views: 1459
Reputation: 4021
You could use a query string. You could set the link in JavaScript like this:
var a = document.getElementById('linkId');
a.href = "link?var=" + var;
You would have to run this code each time you change your variable.
If you need to parse the query string I would refer to this post: How can I get query string values in JavaScript?
Upvotes: 1