• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

11. Managing Style Sheets > 11.7. Enabling/Disabling Style Sheets

Enabling/Disabling Style Sheets

NN 6, IE 4

Problem

You want to activate or deactivate a style sheet in the page to change between style sheets dynamically.

Solution

To turn off a style sheet, assign the Boolean value true to a styleSheet object’s disabled property:

document.styleSheets[1].disabled = true;

Conversely, to re-enable the style sheet, set its disabled property to false:

document.styleSheets[1].disabled = false;

Even some recent browser versions do not respond reliably to these statements. Occasionally you can disable and enable a link element object that has loaded a style sheet. A style element object has a disabled property supported by IE 4 and later as well as NN 6 and later.

Discussion


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint