How to hide the class on the click and display another, throughout a site?


I have a site on which I use several divs with one class, which are displayed, and severals divs with an other class which are hidden.

I would then like to have two buttons, which I can use to toggle between which one of the two classes are displayed, with the button for the currently displayed class beeing inactive.

When the button is clicked I would like it to take effect all through the site, so the correct class is also displayed or hidden on other pages on the site.

To simplify: So if I click button A, class A is displayed all through the site, and button B is hidden. If I then click button B, class B is displayed all through the site, and button A is hidden.

Any ideas to an easy solution for this?

Since new UK legislation requires you to tell the users of the website about all cookies the website stores on their machine, I would recomend you use a session variable, you could use $_SESSION['class']="class1"; using PHP or you could use Session["class"] = "class1"; in C#, you could then check that session variable using an if statement by doing:

if($_SESSION['class'] == "class1")
    // show class 1
    // Show class 2

Te above code will work in C# by replacing the $_SESSION['class'] with Session["class"] To show or hide a div, you could either do it server side by adding the different styles in problematically or you could use javascript, though I'm not sure how you'd gain access to session variables via JavaScript since they are server side. JQuery would be a good library to use for showing/hiding DIVs though.