XUL Programmer's Reference Manual

<radio>

Attributes Common Children
value * * *
accesskey  
disabled  
oncommand  
id  
class  
checked  
crop  
imgalign  
src  

A <radio> element appears within a radiogroup. Within a radiogroup, only one radio item can be selected at any one time.

 
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> 

<window id="radio show" 
  xmlns:html="http://www.w3.org/1999/xhtml"
  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

  <box style="background-color: lightblue;">
	
    <radiogroup orient="vertical">
	<radio value="James Joyce" />
	<radio value="Joseph Conrad" />
	<radio value="William Faulkner" />
    </radiogroup>
  </box>
</window>

 
value
Description
The value attribute specifies the name displayed for the radio item.
Syntax
<radio value="string" />
Example
<radio value="Honda"/>
<radio value="Isuzu" />
Notes
None.
checked
Description
When checked is set to "true", the radio item is pre-selected in the radiogroup.
 
Syntax
checked="[true | false]"
Example
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> 

<window id="radio show" 
  xmlns:html="http://www.w3.org/1999/xhtml"
  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

  <box style="background-color: lightblue;">
	
    <radiogroup orient="vertical">
	<radio value="James Joyce" />
	<radio value="Joseph Conrad" checked="true" />
	<radio value="William Faulkner" />
    </radiogroup>
  </box>
</window>

Notes
None.
 
oncommand
Description
oncommand is an optional event listener attribute for the radio item.
Syntax
<radio id="string" value="string" oncommand="event handler code" />
Example
<radio id="saveKey" value="Honda" oncommand="doHondaPrep()" />
Notes
None.

 

 

crop
Description
crop is an optional attribute which part of the radio item's text, if any, is clipped when the parent container doesn't provide enough space.
Syntax
<radio crop="left | right | none" />
Example
<radio value="Long Name For This Radio Item" crop="left" />
Notes
None.

 

 

imgalign
Description
imgalign is an optional attribute for aligning the imported graphic with the radio item.
Syntax
<radio src="graphic" 
imgalign="
  absbottom |
  absmiddle |
  baseline  |
  bottom    |
  left      |
  middle    |
  right     |
  texttop   |
  top" />
Example
<radio src="newbutton.gif" imgalign="absmiddle" />
Notes
None.

 

 

src
Description
src is an optional attribute for specifying graphic images to use in place of the radio button itself.
Syntax
<radio src="chrome or regular url to graphic" />
Example
<radio src="chrome://global/newradio.gif" />
Notes
None.

 

 


 
 
Last updated: 3/21/00 Ian Oeschger