Chapter 8: Forms and Regular Expressions

Return to Chapter 8

 

To use this script on your own page, click in the text area below, select all, and copy to grab the script. Then, just paste into your own page — and you're done.

Replacing Elements using Regular Expressions

See it run: Replacing Elements using Regular Expressions

Script 8.8

This JavaScript uses regular expressions to replace the names of page elements. This particular script uses regular expressions to build three-state rollovers.

Images:

button1_on.gif
button2_on.gif
button1_off.gif
button2_off.gif
button1_click.gif
button2_click.gif