Home >Web Front-end >HTML Tutorial >Usage analysis of
Radio object represents a radio button in an HTML form. Each time appears in an HTML form, a Radio object is created. A radio button represents one of a set of mutually exclusive option buttons. When a button is selected, the previously selected button becomes unselected. When a radio button is selected or unselected, the button fires the onclick event handler. You can access the Radio object by iterating over the form's elements[] array, or by using document.getElementById(). Collected and organized by www.169it.com
1. Radio button control syntax
|
|
2. Radio radio button code example
1 2 3 4 5 6 7 8 |
1. HTML code snippet:
|
1 2 3 | Students Teacher Administrator |
In the two code examples, checked="checked" indicates the default selected item settings.
3. Code example three (js operation radio):
|