JAVASCRIPT fill dropdown from xml file javascript - Net-Raft.com

Welcome aboard! We are happy you are here and wish you good net-raft!




Just a Web Code Solution
join us

how to fill a dropdown from xml file using javascript ?


 318

Show Result
tech.xml
JAVASCRIPT


2

<!DOCTYPE html>
<html>
<body>

<select id="demo"></select>

<script>
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
myFunction(this);
}
};
xhttp.open("GET", "/project/macho2/sl_Jpm9vQYr0Z202145629/tech.xml", true);
xhttp.send();

function myFunction(xml) {
var i;
var xmlDoc = xml.responseXML;
var x = xmlDoc.getElementsByTagName("LANG");
for (i = 0; i < x.length; i++) {

document.getElementById("demo").innerHTML = document.getElementById("demo").innerHTML + "<option>" + x[i].getElementsByTagName("TECH")[0].childNodes[0].nodeValue;

}
}
</script>

</body>
</html>


By        
The power of the user (%)
9%



The most helpful JAVASCRIPT solutions

How to get client machine name or computer name with javascript ?How to get client machine name or computer name with javascript ?JAVASCRIPT

Click to see more ...

  18K     396

get client hostname javascriptget client hostname javascriptJAVASCRIPT

Click to see more ...

  4.6K     301

How can I get the last day and the next day in javascript ?How can I get the last day and the next day in javascript ?JAVASCRIPT

Click to see more ...

  4.6K     276

create 3d barrel using javascriptcreate 3d barrel using javascriptJAVASCRIPT

Click to see more ...

  3.4K     258

Create fireworks using javascriptCreate fireworks using javascriptJAVASCRIPT

Click to see more ...

  3K     204

create qr code javascriptcreate qr code javascriptJAVASCRIPT

Click to see more ...

  2.5K     205

detect ie javascriptdetect ie javascriptJAVASCRIPT

Click to see more ...

  2.7K     194

how to create foreach class using javascript ?how to create foreach class using javascript ?JAVASCRIPT

Click to see more ...

  2.1K     178

fire event when user is idle javascriptfire event when user is idle javascriptJAVASCRIPT

Click to see more ...

  2.4K     179

create earth in universe with three.jscreate earth in universe with three.jsJAVASCRIPT

Click to see more ...

  2.3K     177

Welcome aboard!
We are happy you are here and
wish you good net-raft!