HTML DOM Input Radio Object | HTML Input Radio | Input Type Radio

HTML DOM Input Radio Object


Radio Object

For each instance of an HTML <input type="radio"> tag on a form, a Radio object is created.

All Radio objects are stored in the elements array of the corresponding form. You can access a Radio object by indexing this array - either by number (0 represents the first element in a form) or by using the value of the name attribute.

The Radio object's properties, methods, and events are described below:

N: Netscape (including Mozilla when N6 or higher), IE: Internet Explorer, W3C: World Wide Web Consortium (Internet Standard)

Properties

Syntax: object.property_name

Property Description N IE  W3C
accept Sets or returns a list of content types that the server that processes this form will handle correct   - Yes
accesskey Sets or returns the keyboard key to access the radio button   4 Yes
align Sets or returns the alignment of the radio button according to the surrounding text   - Yes
alt Sets or returns an alternate text to display if the browser does not support radio buttons   - Yes
checked Sets or returns the current state of the radio button (true if selected and false if not selected) 2 3.02 Yes
defaultChecked Sets or returns the default value of the checked attribute (true if checked by default and false if not) 2 3.02 Yes
disabled Sets or returns whether or not the radio button should be disabled   5.5 Yes
form Returns a reference to the radio button's parent form 2 3.02 Yes
id Sets or returns the id of the radio button (In IE 4 this property is read-only)   4 No
name Sets or returns the name of the radio button 2 3.02 Yes
size Sets or returns the size of the radio button   3.02 Yes
tabIndex Sets or returns the tab order for the radio button   4 Yes
type The type of the form element. For a radio object it will always be "radio" 3 3.02 Yes
value Sets or returns the value of the value attribute of the radio button 2 3.02 Yes

Methods

Syntax: object.method_name()

Method Description N IE W3C
blur() Removes focus from the radio button 2 4 Yes
click() Simulates a mouse-click on the radio button   4 Yes
focus() Sets focus on the radio button 2 3.02 Yes
select() Selects the radio button 2 4 No

Events

Syntax: object.event_name="someJavaScriptCode"

Event Description N IE W3C
onBlur Executes some code when the radio button loses focus 2 4  
onClick Executes some code when the user clicks on the radio button   4  
onFocus Executes some code when the radio button gets focus 2 3.02  
onSelectStart Executes some code when the radio button is selected