selectByCaption Method

             

Selects an item in an OptionGroup object based on the caption.

Syntax

object.selectbyCaption(strCaption)

Parameters

object

An OptionGroup script object.

strCaption

A caption string.

Remarks

Returns the index of the selected item if successful, and -1 if not successful.

Example

The following script creates a group of five option buttons, and selects the fourth one.

function window_onload() 
{
   for ( i=0; i<5; i++)
   {
      optTest.addItem("Item " + i, i );
   }
   optText.selectByCaption("Item3");   // select the fourth item in the group
}