[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Javascript and forms



I have a small problem accessing form-vars via JavaScript.
In below example, I have two vars in a form,
  one of type radio (n0)
  and a normal input-var (n1).

In the JavaScript Function CheckInput() I can acces the value of
n0, but not of n1
.
Depending on the browser, I get different results:
  konqueror : always b1
  opera     : undefined
  mozilla   : undefined
  galeon    : undefined

-----------
<html>
  <form name="ArgsForm" onsubmit="return CheckInput()">
    b1 <input type="radio" name="n0" value="b1"><br>
    b2 <input type="radio" name="n0" value="b2"><br>
    string <input name="n1" size=20><br>
    <input type="submit" value=" Execute ">
  </form>
  <Script language="JavaScript">
    function CheckInput()
    {
      alert(document.ArgsForm.n0.value);
      alert(document.ArgsForm.n1.value);
      return false;
    }
  </Script>
</html>
-----------

So I must be missing something very obvious here.
Can anybody point me to the right direction?

advTHANXance, Micahel





Reply to: