Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Changing Color Background  (Read 2969 times)

0 Members and 1 Guest are viewing this topic.

SMYS

  • Guest
Changing Color Background
« on: October 28, 2006, 09:06:17 AM »
I need to know how to change the color background on the website im building.  I want it to have five different colors.  Once the viewer selects one, I want it to change the color background for the entire site and save that color once they visit the site again.

soybean



    Genius
  • The first soybean ever to learn the computer.
  • Thanked: 469
  • Computer: Specs
  • Experience: Experienced
  • OS: Windows 10
Re: Changing Color Background
« Reply #1 on: October 28, 2006, 11:28:24 AM »
I think one way to do this is to actually have five complete versions of your website with links on the home page to choose background color.  Once the site visitor clicks on a link for a different background color, a home page with that background color would open and all links to  other pages from that page would have that background color.  To choose a different color, the visitor would go back to the original home page and make the selection there.

I don't know how you could just have one set of web pages and have the background color change throughout the site, and I know the above procedure would be quite cumbersome.  I would not want to do it.

Raptor

  • Guest
Re: Changing Color Background
« Reply #2 on: October 28, 2006, 05:11:20 PM »

soybean



    Genius
  • The first soybean ever to learn the computer.
  • Thanked: 469
  • Computer: Specs
  • Experience: Experienced
  • OS: Windows 10
Re: Changing Color Background
« Reply #3 on: October 28, 2006, 05:29:35 PM »
I'm aware of CSS and it's definitely a cool technique, but it's generally applied to web pages by the website developer before uploading the pages to the web server, and a special CSS file must also be uploaded to the server.  But, I still have some doubt that he can utilize CSS to do what he wants to do.  Maybe Rob Pomeroy knows the answer to this.

Rob Pomeroy



    Prodigy

  • Systems Architect
  • Thanked: 124
    • Me
  • Experience: Expert
  • OS: Other
Re: Changing Color Background
« Reply #4 on: October 30, 2006, 03:34:07 PM »
Aye.  You can use javascript to change a page's stylesheet.  In other words, click on something and a completely different set of colours, stylings etc. can be applied without reloading the page.  Just google for "javascript change stylesheet" for more on this.

I did this on a website recently, but I've deleted it, otherwise I would actually be less lazy, and post some code here.  ;D  It was one web site with three different CSS files, all in different colour schemes.  Load them as alternative stylesheets, then use the javascript DOM to swap them when you click on a button or whatever.
« Last Edit: October 30, 2006, 03:35:10 PM by robpomeroy »
Only able to visit the forums sporadically, sorry.

Geek & Dummy - honest news, reviews and howtos