[thelist] Global CSS changes onClick

martin burns martin at members.evolt.org
Tue Aug 1 04:10:09 CDT 2000


isaac wrote:

> > I think that Martin is wondering if it's possible to change the CSS or
> > stylesheet link onClick. ie, without reloading the page as
> > template.blah?printable=fuckyeah. Click a link, and the background
> goes white,
> > text goes dark, and navigation disappears or something.

Yup - that kind of thing

James wrote:
>
> Its doable, but you'll need to set each CSS property in the
> corresponding
> Javascript DOM object. You can't just say 'use the .printable' version
>
> document.body.bgcolor = "#ffffff";
>
> loop throught the p[] arrary, and set all those, etc.

Damn - I was hoping to avoid the brute force method.

> I've set bgcolors in tables dynamically in js on both IE and NN ->
> without
> testing, I'm not sure you can do the body - but I'd say give it try.

The body is fairly easy because you can just do <body id="foo"> and change the properties as with any other named object (actually there's even a DW behaviour to do it for you, although the behaviour doesn't recognise body, so you can do it with a div and move the 'id="foo"' to the body tag afterwards)

I was hoping to do this without having to explicitly name anything, just a global change.

Cheers
Martin





More information about the thelist mailing list