To add a value (listitem):
var list = document.getElementById ("ListBox1");
if (list)
{
alert("selected Index= " + list.selectedIndex;
var option= document.createElement ("option");
list.options.appendChild(option);
var txt = document.getElementById ("txtListItem");
option.text=txt.value;
}
The ListBox server control renders an HTML select object on the browser. To
manipulate it using JScript (or Javascript) use the options collection of the
HTML SELECT object. There is a "remove" method for the options collection.
For a sample on managing the viewstate of ListBox server control on the
browser:
http://www.societopia.net/samples/li...lientside.aspx
--
[note: if this post answers your question, you can mark it as an answer
using the web-based newsreader functions]
-----
HTH,
Phillip Williams
http://www.societopia.net http://www.webswapp.com
"RFS666" wrote:
Hello together,
I wanted to ask if somebody can help me with accessing a listbox (a
serverside webform from the designer-toolbox) from clientside JScript. I need
to add and remove values and find out about the selected index.
I hope somebody can help & thanks in advance
RFS666