Results 1 to 3 of 3

Thread: Selectbox error

  1. #1
    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 ??

  2. #2
    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

  3. #3
    Join Date
    Apr 2008
    Posts
    2,005

    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.

Similar Threads

  1. Replies: 5
    Last Post: 04-05-2011, 10:50 AM
  2. Replies: 6
    Last Post: 12-11-2010, 11:37 PM
  3. Server Error: 451, Socket Error: 10053, Error Number: 0x800CCC0F
    By Eigenberg in forum Windows XP Support
    Replies: 3
    Last Post: 03-06-2008, 04:13 PM
  4. Replies: 3
    Last Post: 21-07-2005, 01:07 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,678,426.80521 seconds with 16 queries