JavaScript - using javascipt function to check index

function sindex()
{
if (sel_agefrom.SelectedIndex == 0 || sel_ageto.SelectedIndex==0)
{
alert (“Select from and to age”);
return false;
}
}

i have above script with dropdown and a command button on page
the command button has OnClick event which eexecutes code behind

if the drop down has selected index as 0 the above alert should popup and the onclick shld not get executed

error
Microsoft JScript runtime error: ‘sel_agefrom’ is undefined

Hi,

The code you posted seems alright.
Could you post a link to a page where I can see this no working, or a small HTML snippet with which I can recreate the problem.
Also, which version of IE is it not working in?