Changes

Jump to: navigation, search

Building Forms with JavaScript

25 bytes added, 14:39, 17 May 2007
JavaScript Radio Buttons
<form action="" name="orderForm">
<input type="RADIO" name="myColor" value="Red" checked> Red
<input type="RADIO" name="myColor" value="Green" checked> Green <input type="RADIO" name="myColor" value="Blue" checked> Blue
</form>
</pre>
The above statements create a Radio Box group containing 3 Radio Buttons: [[Image:Javascript radio buttons. jpg]] All three button share the same ''name'' attribute which acts to tie them together into a group. The ''value'' attribute defines the value that is passed through the server to indicate which button is selected when the form is submitted.
Ther are number of actions that can be performed in JavaScript when working with Radio Buttons. Firstly, you can find out the number of Radio Buttons ina group by accessing the ''length'' property:

Navigation menu