Style Switcher

By Micah Atwell on Jan 10, 2007


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.


  • Created by: Micah Atwell
  • Web Site:
  • Posted: January 10, 2007

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


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


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


Paste this code into the BODY section of your HTML document