Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Calling css file from javascript

Options
  • 02-02-2006 10:09pm
    #1
    Closed Accounts Posts: 201 ✭✭


    I am writing some javascript for an extension to Thunderbird , and I need to change the font colour of some text to different colours depending on certain calculations made in the javascript.

    What I am wondering is there a way of calling the css file that holds the code for changing the font colour directly from the javascript something like

    if(priority==6)
    {
    //call css file that changes font colour to red
    }


Comments

  • Registered Users Posts: 32,136 ✭✭✭✭is_that_so


    You may find this of use. It gives examples of changing css rules. This would do what you want to do.
    Also look out for CSS objects.

    http://www.javascriptkit.com/dhtmltutors/externalcss2.shtml

    You could also consider using the DOM to rewrite the HTML using getElementById methods


  • Closed Accounts Posts: 17,208 ✭✭✭✭aidan_walsh


    If you're building an extension, why not just manipulate the DOM?

    [ Full index ]


  • Closed Accounts Posts: 201 ✭✭bazcaz


    I am not sure exactly how to manipulate the DOM I mean I have a Dom inspector extension installed in thunderbird but I am not sure exactly how to use it , I am trying to change the font colour of subject lines in inbox


  • Closed Accounts Posts: 201 ✭✭bazcaz


    The thing is I have a little bit of code in a css file that does exactly what I want I just want to know if there is anyway of just called my extension.css file if a certain condition is met in the javascript


Advertisement