setText Method

See Also            Applies To

Sets the text string of an item in a Listbox object.

Syntax

object.setText(strItem [, nIndex])

Parameters

object

A Listbox script object.

strItem

The text that will be displayed in the list box for this item.

nIndex

Index of an item in the zero-based list. If left null, the index defaults to the currently selected item. The index of the currently selected item is equivalent to the value of the selectedIndex property.

Example

function window_onload() 
{
   for ( i=0; i<5; i++)
   {
      lstTest.addItem("Item " + i );   
   }
   lstTest.selectedIndex = 3;
   lstText.setText("PickMe");   // Changes the text of the 4th item, which is the currently selected item
}