Say in index.html you set variable x to be 5.
You navigate to a different page, lets say pageone.html.
How can you keep x to 5?
And if you change x to 3 on pageone.html, how can you keep it to 3 on pagetwo.html? (the whole website also, every webpage)
Is this possible in javascript or do you need php?

Will give more explanations if needed.
thanks

edit: i did try googling, but i really didnt know how to phrase it for a search so it kinda messed up.

edit 2:
think umm.. like a shop website, you add something to your basket, the basket will say 1 item and will stay like that on every webpage.

Javascript can read & write information to both cookies and a special client side storage area if a large amount of stuff needs to be stored. However it is not very secure as the visitor can ammend any data stored in their browser.

PHP does this sort of thing a lot better using session variables, plenty of good tuts out there.

Javascript can read & write information to both cookies and a special client side storage area if a large amount of stuff needs to be stored. However it is not very secure as the visitor can ammend any data stored in their browser.

PHP does this sort of thing a lot better using session variables, plenty of good tuts out there.

It's okay, this is just for college. We were only supposed to do a simple webpage (not even including css) but i've gone way overboard trying to get a distinction. Anything will do at this point. I don't really want to use php right now really, so do you think javascript would be okay?

This may be of interest.

Airshow

This may be of interest.

Airshow

Thanks for that. +1

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.