Not signed in (Sign In)

Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.


    • CommentAuthorjohn
    • CommentTimeNov 6th 2006
     
    Is there any way to access a JavaScript variable with CSS?

    Like if I wanted to do this:

    <script language="javascript">
    var fontColor = '"#FFFFFF";
    </script>

    <style type="text/css">
    body {
    color: fontColor;
    }
    </style>

    Obviously the fontColor in CSS would be the value that the fontColor var is set to in the script above.

    Is there anyway to do this? Wouldn't it be awesome if there was?
  1.  
    I do not believe that specific technique is possible, but you can dynamically change CSS through Javascript, including a specific element's CSS (by ID).
    • CommentAuthorjustnajm
    • CommentTimeDec 18th 2006
     
    Hi,

    Its Amazing, why do you want to do that when javascript can handle the css and even you will not have to write any of the css code. Javascript can perform everything and more which css can perform.

    CSS basics are to improve interface and giving a good design. It was all possible through javascript but CSS makes it easy to handle the design. And javascript for validation and other logical client base tasks.