jeudi 29 janvier 2015

JavaScript var getElementById if statement not working

I can't figure out how to code this in JavaScript/html: I basically need an option so the customer can pick the language he wants and based in the he can see what promotion is available in that language and choose the one he wants.



<script>
Function PromoLanguage(){
Var language = document.getElementById('languages');
Var a = language.selectedIndex;
If (a == 1){
Document.getElementById('French').style.display = display;
}
Else if (a == 2){
Document.getElementById('English').style.display = display;
}
Else if (a == 3){
Document.getElementById('German').style.display = display;
}
Else () {}
}
</script>
<body>
<select onchange="PromoLanguage()" id='languages'>
<option>French</option>
<option>English</option>
<option>German</option>
</select>

<select id='English' style='display: none'>
<option>ENGLISHPROMO1</option>
<option>ENGLISHPROMO2</option>
<option>...</option>

<select id='French' style='display: none'>
<option>FRENCHPROMO1</option>
<option>FRENCHPROMO2</option>
<option>...</option>

<select id='German' style='display: none'>
<option>GERMANPROMO1</option>
<option>GERMANPROMO2</option>
<option>...</option>

Aucun commentaire:

Enregistrer un commentaire