-
Selectbox error
I have a selectbox and the user can choose languages through onChange ();
Now, this does not work. I get a JavaScript error, but do not know why.
HTML Code:
<form class="languageSwitch" name="form1" action="">
<select class="taalKeuze" name="select1" onchange="languageChange();">
<option value="NL" selected="selected"> Dutch - EN </ option>
<option value="UK"> English - UK </ option>
<option value="DE"> Deutsch - DE </ option>
</ select>
</ form>
JavaScript
Code:
<script type="text/javascript">
Change language function () (
if (document.form1.select1.value == NL)
window.location = 'default.php';
else if (document.form1.select1.value == UK)
window.location = 'default uk.php';
else if (document.form1.select1.value == DE)
window.location = 'default de.php';
)
</ script>
The error: 'EN' is not defined
Anyone for help ?? :crybaby:
-
Re: Selectbox error
Edit / So when I EN and DE, etc. in a varriabele continued, it was error away but it still does not work. When I use the letters in the value changed the numbers. 1, 2, 3 everything was suddenly so. Why does it happens with numbers and letters ?
It is already solved ;)
-
Re: Selectbox error
Because the text in quotation marks should post. Now the variables.
Code:
if (document.form1.select1.value == NL)
must therefore be
Code:
if (document.form1.select1.value == 'EN')
A number (integer) may be used without quotation marks.
Page generated in 1,717,395,213.85856 seconds with 10 queries