...

View Full Version : Fade in code does not work with AJAX in IE



lauthiamkok
01-12-2009, 02:21 AM
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

A1ien51
01-12-2009, 05:36 PM
Not sure if this is a typo:


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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum