"Eddie Clark" <ed***@coolclark.com> wrote in message
news:%2*****************@TK2MSFTNGP11.phx.gbl...
I'm trying to access the items in a listbox from a client-side vb script.
<asp:listbox id="ListBox1" style="Z-INDEX: 101; LEFT: 16px; POSITION:
absolute; TOP: 120px" runat="server" Width="400px" Height="104px"
AutoPostBack="True"></asp:listbox>
I've tried several different ways using document.form1.listbox1 but
nothing seems to work
Any help would be appreciated.
<script>
for(var i = 0; i < document.form1.ListBox.length; i++)
{
if(document.form1.ListBox.options[i].selected)
{
alert(document.form1.ListBox.options[i].value + ' is selected');
}
else
{
alert(document.form1.ListBox.options[i].value + ' is not selected');
}
}
</script>
Also, note that JavaScript is case-sensitive, so there's no point in using
document.form1.listbox1 to try to refer to a dropdown whose id is actually
ListBox1...