logo

Add Item to ListBox JavaScript

JavaScript: The Definitive Guide
author: David Nishimoto

function AddItem(lbxSelection,sDisplay,sKey)
{
iIndex=lbxSelection.options.length;
lbxSelection.options[iIndex]=new Option(sDisplay,iIndex+1);
lbxSelection.options[iIndex].value=sKey;
}
s