body class="plain"
body class="cold"
body class="heat"
Other elements within the body pick up this class to choose which colors they get. Now, this could just as easily be a div or table as the parent, but here, it's the body to control the whole thing. I'll omit the CSS; that's not what I'm about to ask regarding.
I would like to have a JavaScript call that changes the CSS class name attribute of the body element (or whatever other element) on the fly and re-styles the page. This seems easier than maintaining two or more separate stylesheets, when all else is staying the same.
My JavaScript is weak. I borrowed from an online example, then broke off functions within that. What I'm trying to do is set up an array with the class names, then use that with a script, which is called from an "a" link element.
However, it isn't working, so I've commented that out and have three separate pages for now, to show what they look like.
Example Web1:
http://www.shinyfiction.com/themes/hc01 … index.html
<link rel="stylesheet" type="text/css" href="styles/hc01-styles.css" />
<!--
<script type="javascript" src="scripts/cssAltClassList.js">
</script>
<script type="javascript" src="scripts/cssClassSwitcher.js">
</script>
-->
<!-- ...etc... -->
<body class="cold" id="idBody">
<!-- ...etc... -->
<!--
<ul class="vertical">
<li><a href="#" onClick="cssClassSwitch( idBody, 'plain', altClassList );">Plain</a></li>
<li><a href="#" onClick="cssClassSwitch( idBody, 'cold', altClassList );">Cold</a></li>
<li><a href="#" onClick="cssClassSwitch( idBody, 'heat', altClassList );">Heat</a></li>
</ul>
-->
<ul class="vertical">
<li><a href="plain.html">Plain</a></li>
<li><a href="cold.html">Cold</a></li>
<li><a href="heat.html">Heat</a></li>
</ul>
[/code]
Writing, Editing, Artwork, Audio, and soon Fonts