mercoledì, ottobre 24, 2007

Modifying Styles via JavaScript

A neat script found on Apple’s Developer site.

The script contains several functions, discussed in detail below. The first three functions set styles, allowing you to discriminate between elements based on their ID, their CLASS, or their tag name. The second set of functions simply allows you to get the current style settings for each element.

The simplest of these is setStyleById(), which takes an element ID, a CSS property, and a value, and sets that element’s property to that value.