I was experimenting with AJAX a bit yesterday and actually got it working in FireFox. When I wanted to see whether it still works in IE, I was not surprised when it didn't.
There seems to be a major difference in DOM Scripting between IE and the other browsers. For example, see the following code:
Now in FireFox, Opera, etc... myQuickPosts.length will return the number of items with the same name. (If I have 10, it will return 10), but in IE it ALWAYS returns 0.Code:var cTotalReturn = xmlHttp.responseText; var cPostId = cTotalReturn.substring(0, cTotalReturn.indexOf("|")); var cPostText = cTotalReturn.substring(cTotalReturn.indexOf("|") + 1); // Get all elements by specific names var myQuickPosts = document.getElementsByName("ajaxQuickPost"); var myEditButtons = document.getElementsByName("ajaxEditButton"); var myQuoteButtons = document.getElementsByName("ajaxQuoteButton"); var myPostIds = document.getElementsByName("ajaxShowPostId"); var myPostTexts = document.getElementsByName("ajaxPostText"); var myPostTitles = document.getElementsByName("ajaxPostTitle"); // try to copy the node var newAjax = myQuickPosts[myQuickPosts.length-1].cloneNode(true); // add the copied node to the body itself document.body.appendChild(newAjax); // set specific values depending on the return from the xmlHttpRequest object // I'm using -2 because: // A) The array starts at 0 // B) I want to fill the second last one, as the copied one will have a display style of none myQuickPosts[myQuickPosts.length-2].style.display = ""; myEditButtons[myEditButtons.length-2].href += cPostId; myQuoteButtons[myQuoteButtons.length-2].href += cPostId; myPostIds[myPostIds.length-2].href += cPostId; myPostTexts[myPostTexts.length-2].innerHTML = cPostText; myPostTitles[myPostTitles.length-2].innerHTML = "<b>" + document.getElementById("txtTitle").value + "</b>";
Am I doing something wrong, or is this a known issue with a known workaround?





Reply With Quote