|
| |
|
|
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
|
|
|
|
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
|
|
|
|
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 %>
|
|
|
|
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 %>
|
|
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
|
|
|