SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Mar 2003
    Location
    Maryland, USA
    Posts
    107
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Detecting if a particular style exists

    Can Javascript detect if a particular style is included on a page? I would like to use styles for formating some text in JavaScript, I would like to check to see if the style exists and if it does use it and if not use font tags to mimic the effects.

    To make things a little more difficult, I am stuck in NN4.x hell. Most tricks using the DOM do not work.

    TIA

    Michael Hatch

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Have you looked at the document.styleSheets[] collection yet?

    http://www.xs4all.nl/~ppk/js/changess.html

    This will work for IE4+ and NS6+ as well as Opera. For NN4, however, you'll have to come up with another workaround.

  3. #3
    SitePoint Zealot
    Join Date
    Mar 2003
    Location
    Maryland, USA
    Posts
    107
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Vinnie, but unfortunately NN4 is not the exception, but the rule. I wish I could just ditch the Netscape altogheter, but that isn't going to happen any time soon.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •