navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

Change CSS file through dropdown

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> Cascading Style Sheets >> Change CSS file through dropdown
Page: [1]
 
Mane

 

Posts: 100
Joined: 7/7/2005
Status: offline

 
Change CSS file through dropdown - 7/14/2005 17:02:56   
Is there a way to make a dropdown list change the css file for the page?
Tailslide

 

Posts: 6003
Joined: 5/10/2005
From: Out here on the raggedy edge
Status: offline

 
RE: Change CSS file through dropdown - 7/14/2005 18:05:25   
You could use a styleswitcher ( a bit of javascript) to change the stylesheets - this could be activated any way you want - clicking on links, dropdowns whatever.

Have a look at Paul Sowden's original at Alistapart and there's a slight twist on the theme here also at Alistapart (Invasion of the Body Switcher)

_____________________________

"My strategy is so simple an idiot could have devised it"
Little Blue Plane Web Design | Blood, Sweat & Rust - A Land Rover restoration project

(in reply to Mane)
bobby

 

Posts: 11394
Joined: 8/15/1969
From: Seattle WA USA
Status: offline

 
RE: Change CSS file through dropdown - 7/14/2005 18:08:31   
I played with an inline stylesheet (not a .css file, but the style declared on each page as an include file) and used ASP to dynamically alter it...

I used a database and cookies...

It wasn't very efficient or easy, but it did the trick and allowed visitors to almost completely customize their surfing experience on that site...



_____________________________

If con is the opposite of pro, is Congress the opposite of progress?


:)

(in reply to Tailslide)
Tailslide

 

Posts: 6003
Joined: 5/10/2005
From: Out here on the raggedy edge
Status: offline

 
RE: Change CSS file through dropdown - 7/14/2005 18:13:20   
The good thing about using dbs/PHP/ASP is that all the "work" is done server-side so it doesn't matter what the user has in the way of plugins, javascript whatever. The good thing about the Javascript styleswitchers is that it's easy to implement and quite efficient.

The absolute best way if you can work it would be to have a JS styleswitcher that works unless the user has JS switched off (about 10% do) and then it would default to the server-side styleswitcher instead - best of both worlds then.

Just... don't ask me how... never got around to doing it yet!

_____________________________

"My strategy is so simple an idiot could have devised it"
Little Blue Plane Web Design | Blood, Sweat & Rust - A Land Rover restoration project

(in reply to bobby)
yogaboy

 

Posts: 377
Joined: 5/22/2004
Status: offline

 
RE: Change CSS file through dropdown - 7/15/2005 6:34:21   
If you are using XHTML you could use the @import to plop (that's a technical phrase) a new style sheet over the top of the main one. I use the stuff below to make sure IE lines up properly, but you could easily change it for a select menu.

This goes in the head tags
<link rel="stylesheet" href="links3.css" type="text/css" />
<!--#include virtual="/includes/slctBrowser.asp"-->

and this is the slctBrowser code
<%
select case browser
case "IE"
Response.write "<style type='text/css'>@import url('/linksie.css');</style>"
end select
%>

(in reply to Tailslide)
yogaboy

 

Posts: 377
Joined: 5/22/2004
Status: offline

 
RE: Change CSS file through dropdown - 7/15/2005 6:40:08   
Forgot this bit - put it right at the top just after the doc declaration. I use it to find out whether they're using IE or not, but there's also a javascript detection bit that I never use, don't know how good it is?????

<%
'declare variables
Dim browserdetect, browser, version, majorver, minorver, platform, tables, cookies, javascript
' create an instance of the Browser Capabilities component
Set browserdetect = Server.CreateObject("MSWC.BrowserType")
browser=browserdetect.Browser
version=browserdetect.Version
majorver=browserdetect.Majorver
minorver=browserdetect.Minorver
platform=browserdetect.Platform
tables=browserdetect.Tables
cookies=browserdetect.Cookies
javascript=browserdetect.JavaScript
%>

(in reply to yogaboy)
Page:   [1]

All Forums >> Web Development >> Cascading Style Sheets >> Change CSS file through dropdown
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts