Opacity in IE with a variable help needed...

Discussion in 'JavaScript' started by twistedspikes, Mar 27, 2008.

  1. #1
    Okay so I have created this script, and I need the opacity to work in IE as well as other browsers.

    It's part of university work, but it's okay to get help with it.

    Here is part of what I have so far (the part doing the opacity changes):

    The line commented out is the line which should make it work with IE, but in fact it buggers up the other browsers and doesn't even work in IE. It works if I place a solid number in, so without using a variable. But I need to use the variable to have it come on screen and become more visible as it gets to the end point.

    If I don't get this tonight then it means i'll have to hand it in without this, which will get me marked down a bit, but not too much (probably the difference between an A and a B though), so if I don't get it done it's not the end of the world, but it'd be nice to have it done.

    Any help would be great,
    Thanks,
    TS
     
    twistedspikes, Mar 27, 2008 IP
    bogart likes this.
  2. So1

    So1 Peon

    Messages:
    45
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    
    if (navigator.appName == 'Microsoft Internet Explorer')
    { div.style.filter = 'alpha(opacity=' + opacity*100 + ')'; }
    else
    { div.style.opacity = opacity; }
    
    Code (markup):
     
    So1, Mar 28, 2008 IP
    twistedspikes likes this.
  3. twistedspikes

    twistedspikes Notable Member

    Messages:
    5,694
    Likes Received:
    293
    Best Answers:
    0
    Trophy Points:
    280
    #3
    Thanks So1 :)

    Can't believe I forgot about concatination like that...ah well, it's sorted now.
     
    twistedspikes, Mar 29, 2008 IP
    buffalo likes this.