master
dsh 1 year ago
parent ddbb5355f4
commit edda01981e

@ -26,21 +26,21 @@ function createHttpRequest() {
function buildOptions(xmlDoc,id) { function buildOptions(xmlDoc,id) {
var selectObj = document.getElementById(id); var selectObj = document.getElementById(id);
if (!selectObj || selectObj.tagName!="TR") { if (!selectObj || selectObj.tagName!="SELECT") {
return; return;
} }
var options = xmlDoc.getElementsByTagName("option"); var options = xmlDoc.getElementsByTagName("option");
//clear select object //clear select object
for (var i = selectObj.length-1 ; i >= 0 ; i--){ // for (var i = selectObj.length-1 ; i >= 0 ; i--){
selectObj.options[i] = null; // selectObj.options[i] = null;
} // }
selectObj.length = 0; selectObj.length = 0;
for (var i=0; i<options.length; i++) { for (var i=0; i<options.length; i++) {
var len = selectObj.length; var len = selectObj.length;
selectObj.length = len + 1; selectObj.length = len + 1;
selectObj.options[len].value = options[i].getAttribute("value"); selectObj.options[len].value = options[i].attributes[0].nodeValue;
selectObj.options[len].text = options[i].getAttribute("text"); selectObj.options[len].text = options[i].attributes[1].nodeValue;
if (options[i].getAttribute("selected") =="selected") { if (options[i].attributes[2].nodeValue =="selected") {
selectObj.options[len].selected = true; selectObj.options[len].selected = true;
} }
} }

Loading…
Cancel
Save