using IF in Select Option
Hi, I'm pretty new at ASP. I've got a sheet I'm trying to modify using an IF statement. I tried putting them in, in different ways, but it either shows up in the form or I get the options multiple times
Code:
<select onchange="NumberOfDogs_onChange();" name="cmbNumberOfDogs" style="font-family:Arial;font-size:XX-Small;width:70px;">
<option <% if strNumberOfDogs = "1" then response.write "Selected"%> value="1">1</option>
<option <% if strNumberOfDogs = "2" then response.write "Selected"%> value="2">2</option>
<option <% if strNumberOfDogs = "3" then response.write "Selected"%> value="3">3</option>
</select>
i have a variable picked up elsewhere strArea, so I was trying to do something like
Code:
if strArea<1000 then
<option <% if strNumberOfDogs = "1" then response.write "Selected"%> value="1">1</option>
elseif strArea <3000 then
<option <% if strNumberOfDogs = "1" then response.write "Selected"%> value="1">1</option>
<option <% if strNumberOfDogs = "2" then response.write "Selected"%> value="2">2</option>
else
<option <% if strNumberOfDogs = "1" then response.write "Selected"%> value="1">1</option>
<option <% if strNumberOfDogs = "2" then response.write "Selected"%> value="2">2</option>
<option <% if strNumberOfDogs = "3" then response.write "Selected"%> value="3">3</option>
I have tried putting the if's in different places, as well as case statement
but usually I end up with my drop down option list as
1
1
2
1
2
3
thanks