Monday, November 3, 2008

add new element in dropdown/listbox using javascript

function addOption(selectbox,text,value )
{
var optn = document.createElement("OPTION");
optn.text = text;
optn.value = value;
selectbox.options.add(optn);
}
function removeOption(selectbox,selectedIndex )
{
selectbox.remove(selectedIndex);
}

No comments: