selectByIndex Method

See Also            Applies To

Selects an item in an OptionGroup based on an index.

Syntax

object.selectbyIndex(nIndex)

Parameters

object

An OptionGroup script object.

nIndex

The index (zero-based) of the item to select.

Remarks

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

Example

function window_onload() 
{
   for ( i=0; i<5; i++)
   {
      optTest.addItem("Item " + i, i );
   }
   optText.selectByIndex(0);   // select the first item in the list
}