Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Keep value of variable

Status
Not open for further replies.

neomax

Programmer
Jul 1, 2006
29
BG
Hello, JavaScript community!

Is it possible to make variable with value in one page and after use it in another?? How variable may keep the value?

Please, write code:)

 
Depends on what you are doing. You can pass values in the query string when requesting the next page and retrieve them using
Code:
...
var x = location.search.substring(1);
x contains everything in the querystring after the question mark. I.e. if the url is then x contains a=b&c=d. So you can parse that to get the value of a or c.

Or you can set a cookie using Javascript. That is more complicated, something I dont do, but others will be able to post sample code or you could search here on cookies or google it, there are probably a million examples on the web.
 
thanks a lot, rac2 :)

how to parse to get value ???
sorry, but I'm newbie in programming
 
sorry, but I'm newbie in programming

Newbie in programming as in "I just started this new programming class" or newbie in programming as in "I just got this new programming job and I don't really know anything about programming"?

-kaht

Looking for a puppy?

silky-icon-left.gif
[small]Silky Terriers are small, relatively odorless dogs that shed no fur and make great indoor pets.[/small]
silky-icon-right.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top