View Full Version : Assigning a new style sheet

09-27-2003, 11:06 AM
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, 11:25 AM
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, 11:29 AM
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, 11:32 AM
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, 03:56 PM
This demo I wrote has a function that switches between style nodes (DOM2 Style support required):

09-27-2003, 04: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.