Forum Moderators: open

Message Too Old, No Replies

ajax + fade effect

works everywhere but IE6...

         

LetItBe

2:31 pm on Jul 26, 2007 (gmt 0)

10+ Year Member



hi,

problem: IE6 does not pay attention to fragment of code which describes the fade effect.

clicking those links different type of content fades in.
works perfectly on Opera, FF, Safari.

javascript code:


function solidMe(subobjstr, op)
{
var subobj = document.getElementById(subobjstr);
subobj.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=" + op + ");";
subobj.style.opacity = op / 100;
}

...


function callAHAH(url, pageElement, callMessage, errorMessage)
{
document.getElementById(pageElement).innerHTML = callMessage;

try
{
req = new XMLHttpRequest(); /* e.g. Firefox */
}
catch(e)
{
try
{
req = new ActiveXObject("Msxml2.XMLHTTP"); /* IE */
}
catch (e)
{
try
{
req = new ActiveXObject("Microsoft.XMLHTTP"); /* IE */
}
catch (E)
{
req = false;
}
}
}

req.onreadystatechange = function() { responseAHAH(pageElement, errorMessage); };
req.open("GET", url, true);
req.send(null);
}

function responseAHAH(pageElement, errorMessage)
{
var output = '';

var subobj = document.getElementById(pageElement);
op = 0;
subobj.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=" + op + ")";
subobj.style.opacity = op;
while(op < 100) {
op = op + 10;
setTimeout("solidMe('" + pageElement + "', " + op + ")", op * 5);
}

if(req.readyState == 4)
{
if(req.status == 200)
{
output = req.responseText;
document.getElementById(pageElement).innerHTML = output;
}
else
{
document.getElementById(pageElement).innerHTML = errorMessage+"\n"+output;
}
}
}

function makeactive(tab)
{
callAHAH('/additional/content.php?id= '+tab, 'spec_content', '<p class="loading">Loading...</p>', 'Error: bad request.');
}

html code:


<a href="javascript:makeactive(1)">Home</a>
<a href="javascript:makeactive(2)">Contact</a>

<div id="spec_content"></div>

any ideas why IE6 is so angry on this code?

thanks a lot

LetItBe

10:29 am on Jul 27, 2007 (gmt 0)

10+ Year Member



so? ;]

whoisgregg

8:52 pm on Jul 27, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Doesn't Microsoft want opacity expressed as ranging from 0.0 to 1.0? It seems like your code is expressing opacity as ranging from 0 to 100?

Added: Ignore me, I'm a bit backwards today... They do want it from 0 to 100 [msdn2.microsoft.com].