469,290 Members | 1,882 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,290 developers. It's quick & easy.

The user determines the Site

My site is all one color basically. But I'd like to give the user the ability to make the site a color of their choice. I have it set up so that they can choose the color of the logon page and save that to favorites if they want. This basically uses a Internet Explorer propietary function.

Anyway after they save the logon page to favorites\bookmark in the color of their choice, I'd like to make the rest of the site that color. I'm thinking a cookie? Or maybe use JavaScript to write to a cookie and use that to determine the CSS I'll use for the bgcolor attribute of the <BODY>. Any suggestions how to accomplish this? Thanks.

--
George Hester
__________________________________
Jul 20 '05 #1
4 1205

What I did, is created a different CSS file for each color ... and
then dynamically write the line to link the right CSS file.

check it out ... www.coolpier.com and www.hotpier.com are the same
site in the same web directory ... click the little button in the
upper right hand corner to toggle between them.

granted, I have some images dynamically written as well, but anyway

some ASP code you could use would look similar to this ...

<%
Select Case Request.QuerySting("siteColor")
Case "blue", "red", "green"
theColor = Request.QuerySting("siteColor")
Case Else '// default purple
theColor = "purple"
End Select
%>

<link rel="stylesheet" type="text/css" href="/cp/_main/stylesheets/<%
=theColor %>_yourstyle.css">

Brynn
www.coolpier.com

On Sun, 11 Jan 2004 03:51:41 GMT, "George Hester"
<he********@hotmail.com> wrote:
My site is all one color basically. But I'd like to give the user the =
ability to make the site a color of their choice. I have it set up so =
that they can choose the color of the logon page and save that to =
favorites if they want. This basically uses a Internet Explorer =
propietary function.

Anyway after they save the logon page to favorites\bookmark in the color =
of their choice, I'd like to make the rest of the site that color. I'm =
thinking a cookie? Or maybe use JavaScript to write to a cookie and use =
that to determine the CSS I'll use for the bgcolor attribute of the =
<BODY>. Any suggestions how to accomplish this? Thanks.

--=20
George Hester
__________________________________


Jul 20 '05 #2
Well I only want the one line in the CSS:

body {bgcolor: color;}

That's a lot of CSS files about 160 in all. There has to be a better way. But I'll look through that. Thx.

--
George Hester
__________________________________
"Brynn" <z@z.com> wrote in message news:40***************@news.comcast.giganews.com.. .

What I did, is created a different CSS file for each color ... and
then dynamically write the line to link the right CSS file.

check it out ... www.coolpier.com and www.hotpier.com are the same
site in the same web directory ... click the little button in the
upper right hand corner to toggle between them.

granted, I have some images dynamically written as well, but anyway

some ASP code you could use would look similar to this ...

<%
Select Case Request.QuerySting("siteColor")
Case "blue", "red", "green"
theColor = Request.QuerySting("siteColor")
Case Else '// default purple
theColor = "purple"
End Select
%>

<link rel="stylesheet" type="text/css" href="/cp/_main/stylesheets/<%
=theColor %>_yourstyle.css">

Brynn
www.coolpier.com



On Sun, 11 Jan 2004 03:51:41 GMT, "George Hester"
<he********@hotmail.com> wrote:
My site is all one color basically. But I'd like to give the user the =
ability to make the site a color of their choice. I have it set up so =
that they can choose the color of the logon page and save that to =
favorites if they want. This basically uses a Internet Explorer =
propietary function.

Anyway after they save the logon page to favorites\bookmark in the color =
of their choice, I'd like to make the rest of the site that color. I'm =
thinking a cookie? Or maybe use JavaScript to write to a cookie and use =
that to determine the CSS I'll use for the bgcolor attribute of the =
<BODY>. Any suggestions how to accomplish this? Thanks.

--=20
George Hester
__________________________________

Jul 20 '05 #3
In article <N4********************@twister.nyroc.rr.com>, "George Hester"
<he********@hotmail.com> writes:
Well I only want the one line in the CSS:

body {bgcolor: color;}

That's a lot of CSS files about 160 in all. There has to be a better =
way. But I'll look through that. Thx.


Then dynamically insert the color code on the server. Only one .css file.

Set a cookie.
When the page loads, read the cookie.
Set the color.
--
Randy
Jul 20 '05 #4
Why not:

<script type="text/javascript">
function getColorFromCookie() {
return 'blue';
}
document.writeln('<style type="text/css">');
document.writeln('body { background-color: ' + getColorFromCookie() + '; }');
document.writeln('</style>');
</script>

Obviously you replace getColorFromCookie() with your own code that reads the cookie.

George Hester wrote:
Well I only want the one line in the CSS:

body {bgcolor: color;}

That's a lot of CSS files about 160 in all. There has to be a better way. But I'll look through that. Thx.

--
George Hester
__________________________________
"Brynn" <z@z.com> wrote in message news:40***************@news.comcast.giganews.com.. .

What I did, is created a different CSS file for each color ... and
then dynamically write the line to link the right CSS file.

check it out ... www.coolpier.com and www.hotpier.com are the same
site in the same web directory ... click the little button in the
upper right hand corner to toggle between them.

granted, I have some images dynamically written as well, but anyway

some ASP code you could use would look similar to this ...

<%
Select Case Request.QuerySting("siteColor")
Case "blue", "red", "green"
theColor = Request.QuerySting("siteColor")
Case Else '// default purple
theColor = "purple"
End Select
%>

<link rel="stylesheet" type="text/css" href="/cp/_main/stylesheets/<%
=theColor %>_yourstyle.css">

Brynn
www.coolpier.com

On Sun, 11 Jan 2004 03:51:41 GMT, "George Hester"
<he********@hotmail.com> wrote:
My site is all one color basically. But I'd like to give the user the =
ability to make the site a color of their choice. I have it set up so =
that they can choose the color of the logon page and save that to =
favorites if they want. This basically uses a Internet Explorer =
propietary function.

Anyway after they save the logon page to favorites\bookmark in the color =
of their choice, I'd like to make the rest of the site that color. I'm =
thinking a cookie? Or maybe use JavaScript to write to a cookie and use =
that to determine the CSS I'll use for the bgcolor attribute of the =
<BODY>. Any suggestions how to accomplish this? Thanks.

--=20
George Hester


--
| Grant Wagner <gw*****@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
* http://devedge.netscape.com/library/...ce/frames.html
* Internet Explorer DOM Reference available at:
* http://msdn.microsoft.com/workshop/a...ence_entry.asp
* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by joe | last post: by
11 posts views Thread by Lloyd Sheen | last post: by
1 post views Thread by Charles A. Lackman | last post: by
4 posts views Thread by sck10 | last post: by
5 posts views Thread by footballhead | last post: by
4 posts views Thread by luna | last post: by
2 posts views Thread by edsuslen | last post: by
1 post views Thread by rudjohn | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.