Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Dec 2008
    Posts
    117
    Thanks
    14
    Thanked 0 Times in 0 Posts

    Fade in code does not work with AJAX in IE

    Hi,

    I am making a multiple simultaneous requests with AJAX for my website, first to load the background with fading effect written in JavaScript, and all these all fine in Firefox and Chrome accept IE for some reasons...

    Here is the link if anyone would like to throw me some light!

    http://lauthiamkok.net/tmp/eatsuttonharbour/beta/

    Is it the fading code which I have to write differently?

    #############################

    document.write("<style type='text/css'>#content1 {visibility:hidden;}</style>");

    function initImage()
    {
    imageId = 'content1';
    image = document.getElementById(imageId);
    setOpacity(image, 0);
    image.style.visibility = "visible";
    fadeIn(imageId,0);
    }

    function fadeIn(objId,opacity)
    {
    if (document.getElementById)
    {
    obj = document.getElementById(objId);
    if (opacity <= 100)
    {
    setOpacity(obj, opacity);
    opacity += 10;
    window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 100);
    }
    }
    }

    function setOpacity(obj, opacity)
    {
    opacity = (opacity == 100)?99.999pacity;
    // IE/Win
    obj.style.filter = "alpha(opacity:"+opacity+")";
    // Safari<1.2, Konqueror
    obj.style.KHTMLOpacity = opacity/100;
    // Older Mozilla and Firefox
    obj.style.MozOpacity = opacity/100;
    // Safari 1.2, newer Firefox and Mozilla, CSS3
    obj.style.opacity = opacity/100;
    }


    #############################


    Many thanks,

    Lau

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    Not sure if this is a typo:

    Code:
    opacity = (opacity == 100)?99.999pacity;
    That line is wrong.

    Also please use code tags when posting code.

    So have you debugged it and see if the code is being called correctly in IE?
    I wonder if it has an issue with the file needing to be fully loaded before it can apply a filter.
    Last edited by A1ien51; 01-12-2009 at 04:43 PM.
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]


  •  

    Posting Permissions

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