Click here to Skip to main content
11,706,477 members (33,646 online)
Rate this: bad
good
Please Sign up or sign in to vote.
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
Posted 19-Nov-12 3:10am
Comments
n.podbielski at 19-Nov-12 13:17pm
   
Just try from root node and try work yourself down through tree selecting desired data. I do that and this always work. Besides how can we help you with anything not knowing XML scheme?
Did you even thought this through?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 146
1 Sergey Alexandrovich Kryukov 140
2 chainerlt 110
3 Mika Wendelius 80
4 ppolymorphe 71
0 OriginalGriff 9,190
1 Sergey Alexandrovich Kryukov 8,407
2 CPallini 5,189
3 Maciej Los 4,756
4 Mika Wendelius 3,686


Advertise | Privacy | Mobile
Web03 | 2.8.150819.1 | Last Updated 19 Nov 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100