Web Analytics Made Easy -
StatCounter Persistent Cookie/Style switch help Please - CodingForum

Announcement

Collapse
No announcement yet.

Persistent Cookie/Style switch help Please

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Persistent Cookie/Style switch help Please

    Hi, sorry, but I am a Rookie here. Hopefully a little simple help...

    I am using a short js that works great for a style switcher but I need to make the settings permanent with a persistent cookie I believe. The code is short and sweet and fast but will only work until the browser is closed. Here's the script...

    <script>
    var StyleFile = "style" + document.cookie.charAt(6) + ".css";
    document.writeln('<link rel="stylesheet" type="text/css" href="' + StyleFile + '" />');
    </script>.

    I am actually changing the css properties of 4 different divs on a price list page. ( display:block & display:none) More explination if needed.

    Here are the links used to change the styles...

    <p><strong><a href="javascript: document.cookie='style='; window.location.reload();">Keystone</a> |
    <a href="javascript: document.cookie='style=2'; window.location.reload();">Actual Cost</a> |
    <a href="javascript: document.cookie='style=3'; window.location.reload();">2.5x Keystone</a> |
    <a href="javascript: document.cookie='style=4'; window.location.reload();">Triple Keystone</a></strong></p>

    Any ideas would be greatly appreciated. I am not a web designer, just re-writing my entire site/exe presentation to current standards for my customers.

    Thank you in advance,
    Brent (csDealer)

  • #2
    I've use this before and it works good:

    http://www.tutorialized.com/tutorial...Switcher/10382

    You specify how long to retain the cookies.

    I sort of question the need to switch styles though ...

    Is there a reason you're not using PHP to dynamically display the pages(s)?
    Last edited by mlseim; Oct 6, 2006, 09:22 AM.

    Comment

    Working...
    X