Re: Javascript and forms
On Thursday 14 November 2002 03:20, Try KDE wrote:
> Your html is ill-formed. The text field should be:
> input type="text" name="n1" size=20
Well, it is not n1, I had the problem with.
Even if I 'correct' it, I still can't see
the value of n0 (the radio-button).
Anybody knows how to access the value of a radio-button in JavaScript ?
-- Michael
>
> -tk
>
> Michael Naumann wrote:
> >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: