Details - Web 2.0 & AJAX :: arrays not being filled in IE
This thread was displayed: 376 times
Starting with 17th May 2007, Adobe Systems will stop offering support for any version of the discontinued InterAKT products. As a result, we will not answer to new support incidents starting with May 17th, 2007. Pending support incidents will still be followed in order to be closed. The product forums will remain open and be transformed in user-to-user forums. The general forums will be made read-only and not allow new posts or comments.
For more information about the affected products visit: www.interaktonline.com/Support/
Aaron Kroll
05-31-2006 09:46:17 GMT +2
|
I have been working on a photo gallery for a client. I am embeding an XML document into the page and asking the page to fill an array for each record in that XML document using getElementsByTagName in Firefox and Netscape this works fine but in IE the array has a length but all of the values are an empty string. I am using the following function to create the arrays.
function preloadImages() { var imgLocations = document.getElementsByTagName("location"); var thumbLocations = document.getElementsByTagName("thumb"); imag = new Array(imgLocations.length); thumbs = new Array(thumbLocations.length);
//This code does not work in IE
for(i=0; i < imgLocations.length; i++){ imag[i] = imgLocations[i].innerHTML; }
for(j=0; j < thumbLocations.length; j++){ thumbs[j] = thumbLocations[j].innerHTML; } //alert(thumbs[0] + "" + images[0]); //alert(thumbs[thumbLocations.length - 1] + " " + imag[thumbLocations.length - 1]); whichThumb = (thumbs.length - 1); }
Would someone please tell me why the arrays are not getting the innerHTML and are blank instead. The page I am making is located at http://djapocalypse.home.comcast.net/annesphotos
|
|
|
Andrei DRAGOMIR[InterAKT]
06-13-2006 14:01:16 GMT +2
|
Hello AAron. The reason that this code is not working on internet explorer is that you are using a piece of xml document and inserting it into the page, an dhten navigating with normal dom methods. However, IE is not so loose about the type of content you have in your page. In order to access the nodes in the xml document you can use the request.responseXML object, which works in both firefox and ie.
I am attaching the modified version of the code which works in both browsers.
|
|
|
Aaron Kroll
06-14-2006 05:11:35 GMT +2
|
Andrei
Thank you for your response. I am still not getting it to work in IE 6 or 7, your version still works in Firefox. Any further suggestions?
|
|
|
Andrei DRAGOMIR[InterAKT]
06-16-2006 10:09:28 GMT +2
|
Hi Aaron.
Could you please put the code on the online server so I can see what the issue is ? I looked at the page, and refreshed it, and it still seems to be the old code.
Regards,
Andrei.
|
|
|