<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;
// selStation = document.getElementById('#station2'),i;
[].forEach.call(xml.querySelectorAll('city'), function (el) {
// selCity.add(new Option(el.getAttribute('name'), el.getAttribute('name')))
document.getElementById('sec1').innerHTML = 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('sec1').innerHTML = el.textContent;
})
})
})
</script>
<select id=city><option selected>33333333</option></select>
<div id="sec1">123</div>
ну где же косяк то