Style Switcher | JavaScriptSource

Style Switcher

Micah Atwell Jan 10, 2007

General

Provide your visitors with a method for toggling the text and background colors of your page or certain sections within it. Though simple, this script has a lot of potential and could be greatly expanded. Heavily commented.


»» Change foreground/background colors

Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.

Ma quande lingues coalesce, li grammatica del resultant lingue es plu simplic e regulari quam ti del coalescent lingues. Li nov lingua franca va esser plu simplic e regulari quam li existent Europan lingues.

Epsum factorial non deposit quid pro quo hic escorol. Olypian quarrels et gorilla congolium sic ad nauseum. Souvlaki ignitus carborundum e pluribus unum. Defacto lingo est igpay atinlay.

Notes

In the body of the Web page, be sure to enclose the text you want to allowed changed with the following division tags:

<div class="textDefault"></div>

Source Code

Paste this source code into the designated areas.

External file

Paste this code into an external JavaScript file named: switchStyle.js


CSS

Paste this code into your external CSS file or in the <style> section within the HEAD section of your HTML document.


Head

Paste this code into the HEAD section of your HTML document.


Body

Paste this code into the BODY section of your HTML document


Leave a Response

(2 comments)

good website

rachid Jan 13, 2007

The HREF attribute for your toggle link should be set to the filename of the document in which this code is used (in case your visitor does not have Javascript enabled).

Micah Jan 10, 2007