When a page consists of more than one style sheet (<style> element with an inline style, or an external style sheet), you can use JavaScript to toggle between these style sheets, activate and deactivate them, and also combine them. The styleSheets property of the document object contains all style sheets on the page, in the order in which they are loaded or appear on a page. The most important property of every style sheet is disabled. If this is set to true, the style sheet becomes invisible and does not affect the layout of the page any longer. There are two approaches to access a specific style sheet:
The former approach does not work well with Mozilla browsers, so you should use the numeric index, as the following code demonstrates: Changing the Style Sheet (stylesheets.html)
|