Click here to Skip to main content
12,403,856 members (72,894 online)
Rate this:
 
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 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
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160721.1 | Last Updated 19 Nov 2012
Copyright © CodeProject, 1999-2016
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