Example of Style Sheet Access in JavaScript

Here's an example that uses getStyleBySelector() to dynamically change the style of a class. The text below contains warnings and features defined as clsses by the style sheet below; by clicking the buttons you can see those parts of the highlighted.

<style type="text/css">
.warning { color: black; }
.feature { color: black; }


Thank you for choosing Blend-O-Matic as your new food processor. The Blend-O-Matic has a large variety of attachments that allow you to stir, whip, blend, and purée your foods. We've even added a gentle rinse cycle for your delicate vegetables!

Your Blend-O-Matic requires a 110 volt AC power supply in the United States, and a 220 volt AC power supply in Europe. A 12-volt DC adapater is included so that you can use the Blend-O-Matic in your car, although you should not operate this device while driving or intoxicated.

All the metal parts are coated with Cruft-B-Gone®, making clean-up a breeze. Do not immerse the blender in water while it is plugged in.

We hope you enjoy using your Blend-O-Matic as much as the grossly underpaid workers in some unnamed third world country enjoyed making it.

  Access from JavaScript  Index JavaScript DOM Utilities