Got this code, which works fine in FF3 - it dynamically redraws a menu
from user input.
####
function so_clearInnerHT ML(obj) {
// so long as obj has children, remove them
while(obj.first Child) obj.removeChild (obj.firstChild );
} - this just for info - ignore that there is no function around the next
bit!
if (httpRequest.st atus == 200) {
var xmldoc = httpRequest.res ponseXML;
//var objNodeList;
//objNodeList = xmldoc.getEleme ntsByTagName
('systemname');
so_clearInnerHT ML(document.get ElementById
("systemslist") );
// loop through the returned xml list for entries and
append them back to the div
var x = 0;
while (xmldoc.getElem entsByTagName(' systemname')[x]) {
//alert('counted['+i+']');
var sysname = xmldoc.getEleme ntsByTagName
('systemname')[x].childNodes[0].nodeValue;
var sysid = xmldoc.getEleme ntsByTagName('s ystemid')
[x].childNodes[0].nodeValue;
//alert('systemna me['+sysname+']');
//alert('systemid['+sysid+']');
// create a DIV element, using the variable eLink as
a reference to it
eLink = document.create Element("a");
//use the setAttribute method to assign it an id
eLink.setAttrib ute("href","fin dsystem.asp?
systemid="+sysi d);
// add the text from 'systemname' to the anchor
element
eLink.appendChi ld(document.cre ateTextNode
(xmldoc.getElem entsByTagName(' systemname')[x].childNodes[0].nodeValue));
// append your newly created element to an already
existing element.
document.getEle mentById("syste mslist").append Child
(eLink);
eBreak = document.create Element("br");
document.getEle mentById("syste mslist").append Child
(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.l ength; 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 user input.
####
function so_clearInnerHT ML(obj) {
// so long as obj has children, remove them
while(obj.first Child) obj.removeChild (obj.firstChild );
} - this just for info - ignore that there is no function around the next
bit!
if (httpRequest.st atus == 200) {
var xmldoc = httpRequest.res ponseXML;
//var objNodeList;
//objNodeList = xmldoc.getEleme ntsByTagName
('systemname');
so_clearInnerHT ML(document.get ElementById
("systemslist") );
// loop through the returned xml list for entries and
append them back to the div
var x = 0;
while (xmldoc.getElem entsByTagName(' systemname')[x]) {
//alert('counted['+i+']');
var sysname = xmldoc.getEleme ntsByTagName
('systemname')[x].childNodes[0].nodeValue;
var sysid = xmldoc.getEleme ntsByTagName('s ystemid')
[x].childNodes[0].nodeValue;
//alert('systemna me['+sysname+']');
//alert('systemid['+sysid+']');
// create a DIV element, using the variable eLink as
a reference to it
eLink = document.create Element("a");
//use the setAttribute method to assign it an id
eLink.setAttrib ute("href","fin dsystem.asp?
systemid="+sysi d);
// add the text from 'systemname' to the anchor
element
eLink.appendChi ld(document.cre ateTextNode
(xmldoc.getElem entsByTagName(' systemname')[x].childNodes[0].nodeValue));
// append your newly created element to an already
existing element.
document.getEle mentById("syste mslist").append Child
(eLink);
eBreak = document.create Element("br");
document.getEle mentById("syste mslist").append Child
(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.l ength; 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?
Comment