473,581 Members | 2,844 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1837
In article <fh**********@n ews.datemas.de> ,
"rhino" <No************ ***********@ano nymous.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************ ***********@ano nymous.comwrite s:
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.con tact.ple...@ano nymous.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
2880
by: mr_burns | last post by:
hi, is it possible to change the contents of a combo box when the contents of another are changed. for example, if i had a combo box called garments containing shirts, trousers and hats, when the user selects shirts another combo box called 'size' would contain sizes in relation to shirts (ie. chest/neck size). the same would occur for...
0
3493
by: starace | last post by:
I have designed a form that has 5 different list boxes where the selections within each are used as criteria in building a dynamic query. Some boxes are set for multiple selections but these list boxes do not necessarily need to have a selection made to be used in the dynamic query. In essence the form can have selections made in all or...
1
7556
by: Shourie | last post by:
I've noticed that none of the child controls events are firing for the first time from the dynamic user control. Here is the event cycle. 1) MainPage_load 2) User control1_Load user clicks a dropdown in UC1 _________________________ 1) MainPage_Load 2) User Control_1 Load
0
1332
by: pbb | last post by:
I have a web page on which I dynamically create controls based on the selection a user makes from a dropdownlist (this ddl is not dynamic). Depending on the user's selection, the controls could be any combination of textboxes, ddls, popup calendars, etc. The properties of the dynamic controls are stored in a SQL database so that my program...
0
2063
by: Pascal Costanza | last post by:
Dynamic Languages Day @ Vrije Universiteit Brussel ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Monday, February 13, 2006, VUB Campus Etterbeek The VUB (Programming Technology Lab, System and Software Engineering Lab), ULB (deComp) and the Belgian Association for Dynamic Languages (BADL) are very pleased to invite you to a whole...
2
7039
by: assgar | last post by:
Hi Developemnt on win2003 server. Final server will be linux Apache,Mysql and PHP is being used. I use 2 scripts(form and process). The form displays multiple dynamic rows with chechboxs, input box for units of service, description of the service and each row has its own dropdown list of unit fees that apply. Each dynamically created...
0
1675
by: Alexandre Bergel | last post by:
Dear colleague, Please, note that after the workshop, best papers will be selected, and a second deadline will then be set regarding preparation of the Electronic Communications of the EASST. Note that we submission deadline has been extended. The important dates: - May 27: deadline for the workshop submissions. Submissions should...
1
2950
by: jmartmem | last post by:
Greetings, I have a nagging problem with client-side dynamic dependent list boxes that perhaps someone can help me troubleshoot. I have a form with a series of dynamic dependent list boxes. Making a selection from list/box A (Qtr) selects a fiscal quarter, which then refreshes the values in list/box B (Mth), which shows the 3 months in that...
0
3261
by: ebernon | last post by:
The Dynamic deletion of Rows and Columns within a program is frequently desired but often hard to obtain. The Help files for VB-6 contained within Excel 2002 (XP) don’t always provide the help you need to perform this operation. By recording a Macro, you can develop the following code snipet: Sub Macro1() ' ' Macro1 Macro ' Macro...
0
7882
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7808
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8312
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6564
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5366
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3809
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2309
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1410
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.