можно еще вопросик, почему не выводит на второй раз результат,
и можно ли передать результат в {$s_city}
строка 3,4
<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_reg.xml"),
selCity = document.querySelector('#city'),
selStation = document.getElementById('ob');
[].forEach.call(xml.querySelectorAll('city'), function (el) {
selCity.add(new Option(el.getAttribute('name'), el.getAttribute('name')))
})
selCity.addEventListener('change', function () {
[].forEach.call(xml.querySelectorAll('city[name=' + this.value + '] > ob'), function (el) {
selStation.innerHTML = el.textContent;
})
})
})
</script>
<select id=city><option selected>1111111</option></select>
<a href=ob id=ob name=links2>111</a>
<a href=ob id=ob name=links2>111</a>
<?php
echo "
<table align=center border=0 cellpadding=0 cellspacing=0 width=100% class=inf4>
<tr>
<td align=center width=15% title=num1><ul class=tops>";
foreach($xml_db->cat_a as $cat_a)
{
echo "<ol class=link1><font color=#ADADAB>{$cat_a['category']}</font></ol>";
foreach($cat_a->marka as $marka)
{
echo "<li align=left><a href=db/auto/{$s_city}/{$marka['link']} class=link2>{$marka['name']}</a></li>";
}
}
?>