-
selectedindex
Can anyone show me how to use the selectedindex property of a selectbox please?
I've tried loads of examples including the one below, but can't get it working!
Code:
<HTML>
<HEAD>
<SCRIPT Language="javascript">
function workgoddamnit()
{
alert(document.frm1.sel1.selectedindex);
}
</Script>
</HEAD>
<BODY>
<FORM Name="frm1">
<SELECT Name="sel1" onchange="workgoddamnit()">
<OPTION Value="a">a</OPTION>
<OPTION Value="b">b</OPTION>
<OPTION Value="c">c</OPTION>
</SELECT>
</Form>
</BODY>
</HTML>
-
try selectedIndex not selectedindex.
A lot of javascript is case sensitive. Like innerText and innerHTML
-
Yeah, just got it thanks! :rolleyes: Doh
-
no probs.
I only know cos I fell into the same trap a few weeks ago :o)