Help - Search - Members - Calendar
Full Version: css page and vbscript within
HTMLHelp Forums > Web Authoring > Cascading Style Sheets
sanjaya78
Hello all,


I'd like to know if it's ok to use vbscript within a css page?
I'm thinking about defining certain variables at the beginning of the style sheet so that it's easy to change between colors (or load the colors from a database so each user can have their own custom colors). I know it's possible and it works but does it go against the w3c standard?

Thanks.
pandy
Works in what? You guessed right, VBScript isn't a w3c standard. It's a Microsoft technology. Don't know what browsers except IE support it, probably none.
Brian Chandler
The best plan is to generate the css files (either on the fly, or "offline") using a preprocessor, such as PHP. Then you can exploit the bits of CSS that work, without being stuck with its half-baked programmability. It's a much sounder idea anyway to do this sort of thing on the server, because you don't have to worry about "support" on someone else's computer system.

Here's a sample page using a CSS stylesheet built on the fly:

http://imaginatorium.org/ecco/

Never mind what it's all about, just click on a colour you fancy from the palette...
Christian J
QUOTE(sanjaya78 @ Oct 30 2008, 08:28 AM) *

I'd like to know if it's ok to use vbscript within a css page?

I don't think you can put MSIE's client-side VBscript code embedded in a style sheet (as opposed to in a HTML document). MSIE's "dynamic properties" can be used inside style sheets, but I don't think they let you set variables.

But you can let variables in a javascript (outside the style sheet) change CSS in several ways, this works more or less in modern browsers. See http://www.howtocreate.co.uk/tutorials/javascript/domcss and linked pages.

QUOTE
I'm thinking about defining certain variables at the beginning of the style sheet so that it's easy to change between colors (or load the colors from a database so each user can have their own custom colors).

Something like this? http://www.barelyfitz.com/projects/csscolor/ see also http://www.alistapart.com/articles/alternate/

QUOTE
I know it's possible and it works but does it go against the w3c standard?

Not necessarily (as long as it's not written directly in the style sheet), but in general I don't think users bother to use style switchers.
Brian Chandler
QUOTE


I immodestly think mine's better.


Darin McGrew
QUOTE
Not necessarily (as long as it's not written directly in the style sheet), but in general I don't think users bother to use style switchers.
I occasionally use them on forum sites, where the default theme is especially annoying. If I visit the site regularly, then I go to the trouble to choose my favorite of the themes they offer. But otherwise, no.

I don't use font-size widgets either. I just set my default font and my minimum font, and that's all I need.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.