I'm with a problem in my ajax code when using IE8. In Firefox everything works perfectly though.
What I'm trying to do is retreiving data from a XML that's generated based on data from the database.
Here's the error the browser returns:
Now, to the AJAX code (where line 3 is line 121, referenced in the error above):Use Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Win64; x64; Trident/4.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Tablet PC 2.0; AskTB5.3)
Date/hour stamp: Sun, 31 Jan 2010 19:32:41 UTC
Message: The Object doesn't support the property or method
Line: 121
Character: 2
Code: 0
Code: Select all
function aplicaBanners(obj,divTop,divLat){
dataArray = obj.getElementsByTagName("banners");
topo = dataArray[0].getElementsByTagName("topo");
lateral = dataArray[0].getElementsByTagName("lateral");
if(topo && topo.length>0){
bannerT = topo[0];
tituloT = bannerT.getElementsByTagName("titulo")[0].firstChild.nodeValue;
linkT = bannerT.getElementsByTagName("link")[0].firstChild.nodeValue;
imagemT = bannerT.getElementsByTagName("arquivo")[0].firstChild.nodeValue;
imgextT = imagemT.substring(imagemT.lastIndexOf('.')+1);
if(imgextT=="swf" || imgextT=="SWF")
htmlT = "<a href=\"http://"+linkT+"/\"><embed src=\"admin/"+imagemT+"\" title=\""+tituloT+"\" /></a>";
else
htmlT = "<a href=\"http://"+linkT+"/\"><img src=\"admin/"+imagemT+"\" title=\""+tituloT+"\" /></a>";
divTop.innerHTML = htmlT;
}
if(lateral && lateral.length>0){
htmlL = "";
for(i=0;i<lateral.length;i++){
bannerL = lateral[i];
tituloL = bannerL.getElementsByTagName("titulo")[0].firstChild.nodeValue;
linkL = bannerL.getElementsByTagName("link")[0].firstChild.nodeValue;
imagemL = bannerL.getElementsByTagName("arquivo")[0].firstChild.nodeValue;
htmlL += "<div><a href=\"http://"+linkL+"/\"><img src=\"admin/"+imagemL+"\" title=\""+tituloL+"\"/></a></div>";
}
divLat.innerHTML = htmlL;
}
}Code: Select all
<?xml version="1.0" encoding="ISO-8859-1" ?>
<banners>
<topo>
<titulo>Banner de teste</titulo>
<link>http://www.teste.com</link>
<arquivo>banners/12647915244b632fe4df78b.jpg</arquivo>
</topo>
<lateral>
<titulo>Banner Lateral 1</titulo>
<link>http://www.bannerlaterialone.com</link>
<arquivo>banners/12648245294b63b0d19e3b5.jpg</arquivo>
</lateral>
<lateral>
<titulo>Banner Lateral 2</titulo>
<link>http://www.bannerlaterialtwo.com</link>
<arquivo>banners/12648261174b63b705bc6f1.jpg</arquivo>
</lateral>
</banners>Thanks in advance,
Hênio.