Changing Style Attributes Dynamically

Changing Style Attributes Dynamically

Microsoft’s IE4 supports the ability to change just about any CSS1 style attribute dynamically. To access an element’s style, use the style object property that corresponds to the style attribute.

For example, to change the font-weight of a



This is my paragraph

your script would include the statement: = "bold";

Don’t know the name of the style property for the style attribute you want to change? The conversion is easy. Starting with the style attribute name, capitalize the first letter of any word after a hyphen, remove the hyphens, and you’ve got that attribute’s style property. For example, the style property for the attribute background-color is backgroundColor and the style property for border-top-width is borderTopWidth.

Note: Although IE allows you to dynamically change the style object in a script block, Navigator does not.

See also  Monetize TikTok For Your Business

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist