View Full Version : Assigning a new style sheet

09-27-2003, 12:06 PM
How can you change the style sheet associated with a page? Maybe something like this (these properties don't actually exist, that's why I'm asking :P)

document.stylesheet = 'newstyle.css';

Is there an easy way to do this?

I can think of possibly one way, reading in a text file and deciphering it, before re-writing each and every style in the sheet with getEl. This is unfeasible in my eyes.

If you're still not sure what i mean, check out www.massless.org, to name just one. You can change the stylesheet.

09-27-2003, 12:25 PM
It's far more likely that they are using alternate stylesheets. Have a look at the Theme Switcher script on my homepage.

09-27-2003, 12:29 PM
I can't see the source. My View->source button doesn't work and you've greyed out the option to 'Edit with notepad'

09-27-2003, 12:32 PM
Hmm, I've done no such thing. And you shouldn't have to view the source anyway: <http://liorean.web-graphics.com/scripts/themeswitch.html>

09-27-2003, 04:56 PM
This demo I wrote has a function that switches between style nodes (DOM2 Style support required):

09-27-2003, 05:18 PM
I've got an example of the theme switcher in use at <http://liorean.web-graphics.com/dhtml/tabs/tabs.html> if you'd like to see an example of what it can be used for.