Programmatically change CSS Style Attributes

Posted on 2006-04-27
Last Modified: 2013-11-19
Is it possible to programmatically change CSS style attributes?  That is, to change the attribute within a named style, not to change the name of a class assigned to an element.   If so, what's the general approach?

Question by:codequest
    LVL 14

    Accepted Solution


    has several examples, using javascript..

    look at the first two (pages 2 & 3), changing styles of id's and page elements (doesn't involve swapping classes).

    the last ones (pages 4 & 5) deal with swapping one class for another (which you say you don't want).
    LVL 2

    Author Comment

    Thanks for the input.  That's a great article, and it does answer the question.  However, I think I asked the wrong question.   So I'm going to award the points and re-ask, once I figure out what the right question is.


    Featured Post

    Javascript: Crash Course

    Javascript is not only emerging as the most important language to know, it's flexibility is unique. With Javascript being deployed on the web, mobile and even the desktop this is the one language that all technologists need to know.

    Join & Write a Comment

    Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
    This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
    In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now