Forum Moderators: mack

Message Too Old, No Replies

Switching styles with HTML?

         

GhostPig

7:56 pm on Aug 8, 2004 (gmt 0)

10+ Year Member



Hello,

I'm currently changing things around on my website - and have previously been using black background and white text (it look quite good really) but I really want to give users the option to switch between a white version and a black version of the site - I have two seperate HTML pages, but isn't there another way of going about this type of thing without using two different web addresses for the two different versions?

Any guidance is welcome!

Ta

chrisnrae

8:47 pm on Aug 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't know much about CSS, but there may be a way you can create an alternate "skin" for the site users could click on and the site would take its form. But again, not 100% sure.

photon

11:38 pm on Aug 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



CSS is definitely the way to go. For an example, take a look at CSS Zen Garden [csszengarden.com]. Every design there uses the same basic HTML file.

Also, check out the CSS forum [webmasterworld.com] here for all kinds of information.

kodaks

3:01 pm on Aug 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Greetings, GhostPig!

I am not sure if this is what you want, but this script will allow the users to change the background color of your site:
------------------------------------------------------
<HEAD>

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
// Copyright 2001 by CodeBelly
// Please do *not* remove this notice.

var backColor = new Array(); // don't change this

// Enter the colors you wish to use. Follow the
// pattern to use more colors. The number in the
// brackets [] is the number you will use in the
// function call to pick each color.

backColor[0] = '#FF0000';
backColor[1] = '#00FF00';
backColor[2] = '#FFC0C0';
backColor[3] = '#FFFFFF';

// Do not edit below this line.

function changeBG(whichColor){
document.bgColor = backColor[whichColor];
}
// End -->
</script>

</HEAD>

<!-- STEP TWO: Copy this code into the BODY of your HTML document -->

<BODY>
<!--
changing bg color with a mouse click.
Set the number in the () in the changeBG() function
to the number of the color in the brackets in the
backColor[] array to select a given color.
//-->

<a href="javascript:changeBG(1)">Change by clicking on link</a>
<!-- Script Size: 1.79 KB -->
------------------------------------------------------

I would also not recommend you use a black background with white text. If a user tries to print your page, nothing will show up on the printout.

I hope this helps, and best of luck!