Change HTML Styles with JavaScript
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().
- Free Useful Javascripts
Links to articles that give free javascript code or javascript examples.
- Altering CSS Class Attributes with JavaScript
- Change HTML Styles with JavaScript
- Select Some Checkboxes JavaScript Function
- Select All Checkboxes in a Form with JavaScript
- Get a Form Element's Label with JavaScript
- Select Radio Inputs JavaScript
- UseMaps Crash IE When Changed
- Hide Select Menus JavaScript
- Manipulating Element Styles Based on CSS Classes Using Prototype
- Compare Values with Arbitrary Comparison Operator
- Related Topics