Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more

Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Web Design Forum > HTML / CSS
User Name
Password

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 06-24-2008, 03:56 PM   #1 (permalink)
marinebio
Junior Member
 
Join Date: Jun 2008
Posts: 2
Default Cookie to set selected css?

Hi all,
Great forums. I've just launched a new design for our site and have one last thing I'm having trouble with. I have 5 css styles users can switch to via javascript links that changes the site's color scheme. It works great except I need it to stick via cookie so the selected css is used page to page and when users return to the site. I understand basic cookie concepts but am lost as to how to connect a cookie to the javascript function in question.

Here's the javascript switch function, css file links, and links that do the switch:
Code:
var doAlerts=false; function changeSheets(whichSheet){ whichSheet=whichSheet-1; if(document.styleSheets){ var c = document.styleSheets.length; if (doAlerts) alert('Change to Style '+(whichSheet+1)); for(var i=0;i<c;i++){ if(i!=whichSheet){ document.styleSheets[i].disabled=true; }else{ document.styleSheets[i].disabled=false;}}}} <style type="text/css">@import "/_n/s/blue_1.css";</style> <style type="text/css">@import "/_n/s/aqua_2.css";</style> <style type="text/css">@import "/_n/s/deep_3.css";</style> <style type="text/css">@import "/_n/s/black_4.css";</style> <style type="text/css">@import "/_n/s/purple_5.css";</style> <style type="text/css">@import "/_n/s/blue_1.css";</style> <a href="javascript:changeSheets(1)">switch 1</a> <a href="javascript:changeSheets(2)">switch 2</a> <a href="javascript:changeSheets(3)">switch 3</a> <a href="javascript:changeSheets(4)">switch 4</a> <a href="javascript:changeSheets(5)">switch 5</a>
I'd really appreciate the help and would be happy to make a donation to whoever helps me get this working properly.
marinebio is offline   Reply With Quote
Sponsored Links
Old 06-24-2008, 07:36 PM   #2 (permalink)
marinebio
Junior Member
 
Join Date: Jun 2008
Posts: 2
Default Re: Cookie to set selected css?

Just found Dynamic Drive DHTML Scripts- Style Sheet Switcher (v1.1) so nevermind...
marinebio is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Points Per Thread View: 1.00
Points Per Thread: 11.00
Points Per Reply: 5.00



» Sponsors

» Links

» Affiliates
Web Hosting
Online Backup Reviews
Marketing Find
Merchant Select
SiteMap Builder
Host Compare
Dedicated Servers

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 08:46 PM.



LinkBacks Enabled by vBSEO 3.0.0 RC8
Webmaster Forums