Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Calling css file from javascript

  • 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, Registered Users 2 Posts: 32,132 ✭✭✭✭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