I want to load the select (drop down list) with data from xml file.
this code is to load xml file:
x = xmlDoc.getElementsByTagName("User");
"User" is the tag i want to catch if i found it, then update inter subTages like:
"UserName","Password","Type".
After catch "User" update depending on select.selected.
Update "Password" will be from Textbox.
Update "Type" will be from select.
This is the code i write but it doesn't get my output, any one could help by new code or edit my code.
var select = document.getElementById("updater");
for (i = 0; i < x.length; i++) {
select.options[select.options.length] = new Option(x[i].getElementsByTagName("UserName")[0].childNodes[0].nodeValue, x[i].getElementsByTagName("UserName")[0].childNodes[0].nodeValue);
}
select. önchange = function update() {
for (i = 0; i < x.length; i++) {
if (document.getElementById("updater").value = x[i].getElementsByTagName("UserName")[0].childNodes[0].nodeValue) {
document.getElementById("password").value = document.getElementsByTagName("Password")[0].childNodes[0].nodeValue;
document.getElementById("Typ").value = document.getElementsByTagName("Typ")[0].childNodes[0].nodeValue;
}
}
}
Thanks