Visual InterDev

setCaption Method

See Also      Applies To

Sets the caption of the object.

Syntax for Label and Checkbox Object

object.setCaption(strCaption)

Syntax for OptionGroup Object

object.setCaption(strCaption [, nIndex])

Parameters

object

A script object.

strCaption

A string that specifies the caption.

nIndex

Specifies the index of an item in the OptionGroup. If nIndex is not supplied, the default is the current item.

Remarks

Returns true if the caption is set, false if not set.

For the Checkbox and OptionGroup objects, the caption is the text that appears next to the check box on the page when viewed on the client browser.

For the Label object, it is the text of the label.

Example

function window_onload() 
{
   for ( i=0; i<5; i++)
   {
      optTest.addItem("foo " + i, i+3 );
   }
   optTest.setCaption("bar", 3);    // change the caption of the 4th item to "bar"
}