Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 05-01-2009
Member
 
Join Date: Oct 2008
Posts: 27
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 ??
Reply With Quote
  #2  
Old 05-01-2009
Member
 
Join Date: Oct 2008
Posts: 27
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
Reply With Quote
  #3  
Old 05-01-2009
Member
 
Join Date: Apr 2008
Posts: 2,001
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.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Selectbox error"
Thread Thread Starter Forum Replies Last Post
Getting Error message ?Northbridge Error, node 2<0>K8 ECC error.? in CentOS 5.5 Pawna Operating Systems 5 04-05-2011 10:50 AM
error “shmget (lowmem) error: Unknown error 999” on linux -Wamil- Operating Systems 6 12-11-2010 11:37 PM
Server Error: 451, Socket Error: 10053, Error Number: 0x800CCC0F Eigenberg Windows XP Support 3 03-06-2008 04:13 PM
Error displaying page error [Error number: 0x80090305] shai Windows Update 3 21-07-2005 01:07 AM


All times are GMT +5.5. The time now is 08:10 AM.