"Eric Chang" <ec****@eatools.com> wrote in message news:<c8*******************@twister.socal.rr.com>. ..
I was working on this simple form with radio boxes.
And when I click on one of the radio box, it tell me the value is
"undefined"
Why is that ? I did defined the value of each radio box:
<input type=radio name='Usetax' value='basic'
onClick='document.myform.amount.value=document.myf orm.Usetax.value'>
<input type=radio name='Usetax' value='no'
onClick='document.myform.amount.value=document.myf orm.Usetax.value'>
<input type=radio name='Usetax' value='mytax'
onClick='document.myform.amount.value=document.myf orm.Usetax.value'>
Can anyone help ?
Thank a lot.
Eric
Hi
I think in the code you should use above in each of the 3 radio
buttons is:
onClick='document.myform.amount.value=this.value'
which will put the string 'basic', 'no' or 'mytax' into the amount
form element (assuming they're the values what you want in amount).
I think document.myform.Usetax doesn't have value because...
document.myform.Usetax is an array of the elements that share the name
'Usetax' so it is 3 radio buttons with 3 values:
document.myform.Usetax[0].value which is 'basic'
document.myform.Usetax[1].value which is 'no'
document.myform.Usetax[3].value which is 'mytax'
but it's nicer to use 'this.value' to get the value of the radio
button clicked.
Hope that helps.
Mark