Friday, November 21, 2008

Working with the DOM Stylesheets Collection

Working with the DOM Stylesheets Collection: "The combination of HTML, style sheets and scripts whose aggregate make up Dynamic HTML, allows us to manipulate any document element on the fly and update page appearance and behavior accordingly. What is less known is the DOM also exposes the style sheets themselves as a property of the document object. Using the document.styleSheets property, you can create, delete and modify existing rules within any style sheet in the page. In general, it's faster and easier to access and modify an element's style directly than through the style sheet, but there are times that the later may be necessary. That's what this article is all about."