Change HTML Styles with JavaScript

Posted Jul 23, 2009
Last Updated Aug 4, 2009

I have received a lot of email over the years from people regarding the popular Change CSS JavaScript function. Some of the questions regard making the function more robust. I may actually make a new function at some point to accommodate some of the needs. However, the best case scenario is to learn some of the powerful styling methods discussed in the video on this page. The examples used in the video are included as a download at the bottom of this page.

The main lessons in this tutorial are how to reference objects via getElementById and getElementsByTagName. Furthermore, the example demonstrates how to change an object's style (or a group of elements' styles) by applying generic style objects to them.

If you find these techniques useful or learn anything valuable from the video or source files, please feel free to leave feedback in the website. Note that the there is a zip file with the source code used in the tutorial; there is also a separate link to a PDF file that you can print for a reference on how to use document.getElementById() and document.getElementsByTagName().


No HTML Tags are permitted.

Wall Worm plugins and scripts for 3ds Max