|
-
Mar 4th, 2002, 08:46 AM
#1
Thread Starter
Evil Genius
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>
-
Mar 4th, 2002, 09:59 AM
#2
Fanatic Member
try selectedIndex not selectedindex.
A lot of javascript is case sensitive. Like innerText and innerHTML
-
Mar 4th, 2002, 10:02 AM
#3
Thread Starter
Evil Genius
Yeah, just got it thanks! Doh
-
Mar 4th, 2002, 10:21 AM
#4
Fanatic Member
no probs.
I only know cos I fell into the same trap a few weeks ago )
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|