Witam,
Mam problem ze scriptem onchange - Ma on za zadanie wybrać z listy rozwijanej wartość (w tym przypadku kraj) a nastepnie na podstawie bazy stworzonej wewnątrz skryptu dopasować do wartości kraju dane lotnisko.
Prawie wszystko działa aczkolwiek po wyborze lotniska nie ma czynności przejścia do podanego linka . Jakiś pomysł jak to poprawić ? Próbowałem też dodać funkcje onclick po tym wyborze aczkolwiek również bez efektu. Poniżej wstawiam screena jak to wygląda + kod. Z góry dzięki za pomoc.
<script type="text/javascript">
var direction=new Object();
direction[1]=[
{value:"0",text:""},
{value:"http://www.wp.pl" , text:"Innsbruck"},
{value:"/direction/Austria/Linz.html" , text:"Linz"},
{value:"/direction/Austria/Salzburg.html" , text:"Salzburg"},
{value:"/direction/Austria/Vienna.html" , text:"Vienna"},
];
direction[2]=[
{value:"0",text:""},
{value:"/direction/Belgium/Brussels_charleroi.html" , text:"Brussels Charleroi"},
{value:"/direction/Belgium/Brussels_zaventem.html" , text:"Brussels Zaventem"},
];
direction[3]=[
{value:"0",text:""},
{value:"/direction/Bosnia_and_herzegovina/Sarajevo.html" , text:"Sarajevo"},
{value:"/direction/Bosnia_and_herzegovina/Tuzla.html" , text:"Tuzla"},
];
direction[4]=[
{value:"0",text:""},
{value:"/direction/Bulgaria/Burgas.html" , text:"Burgas"},
{value:"/direction/Bulgaria/Plovdiv.html" , text:"Plovdiv"},
{value:"/direction/Bulgaria/Sofia.html" , text:"Sofia"},
{value:"/direction/Bulgaria/Varna.html" , text:"Varna"},
];
function setDestination(countryList){
var destinationList=document.getElementById('gm_menu');
destinationList.options.length=0;
var chosen=countryList.options[countryList.selectedIndex].value;
var bd=direction[chosen];
destinationList.options[0]=new Option("choose:","",true,false);
if(chosen!="")
for(var i=1;i<bd.length;i++)
destinationList.options[i]=new Option(bd[i].text,bd[i].value);
else{
destinationList.options.length=0;
destinationList.options[0]=new Option("- choose country first - :","",true,false);
}
}
</script>
<script type="text/javascript">
var gm_menu = document.getElementById('gm_menu');
gm_menu.onchange = function() {
var show = document.getElementById('show');
show.innerHTML = this.value;
}
</script>
<div class="top-menu" style="font-size: 15px; color: gray; background-color: #3f83bf; margin-bottom: 50px; width: 96%px; height: 100px; padding-top: 10px; padding-bottom: 20px; padding-left: 20px;">
<h2 style="font-size: 20px; font-weight: bold; color: white;">Find airport</h2>
<div style="float: left; width: 50%;"><select id="woj_menu" style="width: 80%;" name="woj_menu" onchange="setDestination(this)">
<option value="">- Choose direction -</option>
<option value="1">Austria</option>
<option value="2">Belgium</option>
<option value="3">Bosnia and Herzegovina</option>
<option value="4">Bulgaria</option>
</select></div>
<div style="float: left; width: 50%;">
<select id="gm_menu" style="width: 80%;" name="gm_menu" onchange="MM_jumpMenu('parent',this,0)">
<option value="">- Choose country first -</option>
</select>
</div>
</div>