все доперло
проверти на ошибки пожалуйста
<script>
function loadXMLDoc(filename) {
if (window.ActiveXObject) {
xhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
else {
xhttp = new XMLHttpRequest();
}
xhttp.open("GET", filename, false);
try { xhttp.responseType = "msxml-document" } catch (err) { } // Helping IE11
xhttp.send(null);
return xhttp.responseXML;
}
document.addEventListener('DOMContentLoaded', function () {
var xml = loadXMLDoc("xml/city.xml"),
selCity = document.querySelector('#city'),
// selStation = document.querySelector('#station2'),i;
// elem = document.getElementById('my');
selStation = document.getElementById('station2');
[].forEach.call(xml.querySelectorAll('city'), function (el) {
selCity.add(new Option(el.getAttribute('name'), el.getAttribute('name')))
})
selCity.addEventListener('change', function () {
// selStation.options.length = 0 , i=0;
[].forEach.call(xml.querySelectorAll('city[name=' + this.value + '] > station2'), function (el) {
// selStation.add(new Option(el.textContent, ++i));
//document.getElementById('station2').innerHTML = el.textContent;
selStation.innerHTML = el.textContent;
})
})
})
</script>
<select id=city><option selected>1111111</option></select>
<div id=station2>333333</div>