From: s_m_b on
Got this code, which works fine in FF3 - it dynamically redraws a menu
from user input.
####
function so_clearInnerHTML(obj) {
// so long as obj has children, remove them
while(obj.firstChild) obj.removeChild(obj.firstChild);
} - this just for info - ignore that there is no function around the next
bit!

if (httpRequest.status == 200) {
var xmldoc = httpRequest.responseXML;
//var objNodeList;
//objNodeList = xmldoc.getElementsByTagName
('systemname');
so_clearInnerHTML(document.getElementById
("systemslist"));

// loop through the returned xml list for entries and
append them back to the div
var x = 0;
while (xmldoc.getElementsByTagName('systemname')[x]) {
//alert('counted['+i+']');
var sysname = xmldoc.getElementsByTagName
('systemname')[x].childNodes[0].nodeValue;
var sysid = xmldoc.getElementsByTagName('systemid')
[x].childNodes[0].nodeValue;
//alert('systemname['+sysname+']');
//alert('systemid['+sysid+']');
// create a DIV element, using the variable eLink as
a reference to it
eLink = document.createElement("a");
//use the setAttribute method to assign it an id
eLink.setAttribute("href","findsystem.asp?
systemid="+sysid);
// add the text from 'systemname' to the anchor
element
eLink.appendChild(document.createTextNode
(xmldoc.getElementsByTagName('systemname')[x].childNodes[0].nodeValue));
// append your newly created element to an already
existing element.
document.getElementById("systemslist").appendChild
(eLink);
eBreak = document.createElement("br");
document.getElementById("systemslist").appendChild
(eBreak);
x++;
}

} else {
alert('There was a problem with the request.');
}
####

doesn't repopulate the menu via IE6 or 7
I tried to switch the while to a for -
##
for (var i=0; i<objNodeList.length; i++) {
##
(ignore the x switch in i)

but that returns a zero length list of nodes for IE, and still works for
FF

is there another way for IE to see the existance of the node list, or do
I need to approach the looping some other way?
From: Martin Honnen on
s_m_b wrote:

> is there another way for IE to see the existance of the node list, or do
> I need to approach the looping some other way?

Is responseXML in IE populated? Make sure the server sends the XML with
HTTP response header Content-Type: application/xml (or text/xml) to
ensure that IE/MSXML populate the responseXML property.
With IE you can also check responseXML.parseError.errorCode to test
whether IE had any problems parsing the XML the server sent.


--

Martin Honnen
http://JavaScript.FAQTs.com/
From: s_m_b on
Martin Honnen <mahotrash(a)yahoo.de> wrote in
news:4862334d$0$7547$9b4e6d93(a)newsspool1.arcor-online.net:

> Is responseXML in IE populated? Make sure the server sends the XML
> with HTTP response header Content-Type: application/xml (or text/xml)
> to ensure that IE/MSXML populate the responseXML property.
> With IE you can also check responseXML.parseError.errorCode to test
> whether IE had any problems parsing the XML the server sent.
>

Yes - using
if (httpRequest.overrideMimeType) {
httpRequest.overrideMimeType('text/xml');
}

for all browser flavours.

However, what I hadn't thought of - an should have - was that the file-
specific header in IIS was not sending content-type:text/xml

working now fine, although getting IE to respond to the search box being
cleared is another matter...
From: Martin Honnen on
s_m_b wrote:

> Yes - using
> if (httpRequest.overrideMimeType) {
> httpRequest.overrideMimeType('text/xml');
> }
>
> for all browser flavours.

With IE overrideMimeType is not supported so the above does not help for IE.

--

Martin Honnen
http://JavaScript.FAQTs.com/
From: s_m_b on
Martin Honnen <mahotrash(a)yahoo.de> wrote in
news:48626143$0$27439$9b4e6d93(a)newsspool4.arcor-online.net:

>
> With IE overrideMimeType is not supported so the above does not help
> for IE.
>

Oh, so this is a bit irrelevant... OK

Within the same context, sort of, does IE not detect 'backspace' keys with
onkeypress? With FF, I can delete the input field and Ajax responds, but IE
just ignores this, until I type another search string in.