This feature requires Microsoft Internet Explorer 4.0 or later. Click the icon below to install the latest version. Then reload this page to view the sample. Changing Element Classes There are two primary ways to change the inline style for an element either change the element's style attribute, or change the className of the element to match a defined class in a global style sheet. The following example shows how straightforward it is to change the inline style attribute with an event.
Styles can apply to tag names, element identifiers, or all elements in a class.
This way, multiple elements can belong to a single class, and setting a global style for a class means that the style sheet applies to every element with that class name. Because the class attribute can be scripted, you can dynamically change class associations with elements in a document, as in the following example. This feature requires Microsoft Internet Explorer 5.5 or later. Click the icon below to install the latest version. Then reload this page to view the sample.