471,599 Members | 920 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,599 software developers and data experts.

Dynamic CSS Selection?

I am designing and building a website for a customer and he needs to choose
a colour scheme for the site. He says he'd like to see the site with 8 or 10
different colour schemes so he can choose what he likes best; he feels sure
that he will be able to select at least one that he likes if I show him 10
alternatives.

It seems to me that the best way to do that is to give him a drop down box
containing the names of the colour schemes (e.g. "Dark Green Background",
"Light Blue Background") and then, based on which one he selects from the
drop down, redraw the page using a CSS that has that colour scheme.
Naturally, I'd need 10 CSSs but they would be quite simple and 9 would be
thrown away after he has chosen his colour scheme.

Can anyone suggest a good way to actually code my pages so that he can see
the CSS change dynamically, based on his selection in the dropdown box?

Javascript strikes me as the most obvious option; I'm not quite sure how to
do this though since my Javascript is rather rusty so I've posted to a
Javascript newsgroup.

Are there any better ways to do the same thing? I've never much liked
Javascript and would be delighted to find another way if one exists and is
reasonably straightforward to use.....

--

Rhino
Nov 18 '07 #1
3 1797
In article <fh**********@news.datemas.de>,
"rhino" <No***********************@anonymous.comwrote:
I am designing and building a website for a customer and he needs to choose
a colour scheme for the site. He says he'd like to see the site with 8 or 10
different colour schemes so he can choose what he likes best; he feels sure
that he will be able to select at least one that he likes if I show him 10
alternatives.

It seems to me that the best way to do that is to give him a drop down box
containing the names of the colour schemes (e.g. "Dark Green Background",
"Light Blue Background") and then, based on which one he selects from the
drop down, redraw the page using a CSS that has that colour scheme.
Naturally, I'd need 10 CSSs but they would be quite simple and 9 would be
thrown away after he has chosen his colour scheme.

Can anyone suggest a good way to actually code my pages so that he can see
the CSS change dynamically, based on his selection in the dropdown box?

Javascript strikes me as the most obvious option; I'm not quite sure how to
do this though since my Javascript is rather rusty so I've posted to a
Javascript newsgroup.

Are there any better ways to do the same thing? I've never much liked
Javascript and would be delighted to find another way if one exists and is
reasonably straightforward to use.....
Would he have to see the whole site in every one of the colour
schemes? If not and a home page will do to make this decision, it
is much simpler, just link to 10 different versions of the home
(basically all the same except the link in the head to the css
sheet).

The other way is this. You make 10 folders with the website in
it. All the html files are absolutely identical. But not the (or
the relevant) css sheet.

You can do even better by using includes but either of the above
is so simple, why bother?

--
dorayme
Nov 18 '07 #2
"rhino" <No***********************@anonymous.comwrites:
I am designing and building a website for a customer and he needs to choose
a colour scheme for the site.
<snip>
Can anyone suggest a good way to actually code my pages so that he can see
the CSS change dynamically, based on his selection in the dropdown box?

Javascript strikes me as the most obvious option; I'm not quite sure how to
do this though since my Javascript is rather rusty so I've posted to a
Javascript newsgroup.
Can also be done with a very small amount of server-side scripting and
a cookie to remember the current preference.

--
Ben.
Nov 18 '07 #3
On 18 Nov, 00:08, "rhino" <No.offline.contact.ple...@anonymous.com>
wrote:
Can anyone suggest a good way to actually code my pages so that he can see
the CSS change dynamically, based on his selection in the dropdown box?
Take a look at Eric Meyer's site - he has fragments for doing this.
Nov 19 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by mr_burns | last post: by
reply views Thread by pbb | last post: by
reply views Thread by Pascal Costanza | last post: by
reply views Thread by Alexandre Bergel | last post: by
2 posts views Thread by XIAOLAOHU | last post: by
reply views Thread by Anwar ali | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.