codice:
<%
Function SELECTED(firstVal, secondVal())
For e = 0 To UBound(secondVal)
If cSTR(firstVal) = cSTR(secondVal(e)) then
SELECTED = " selected=""selected"""
End If
Next
End Function
%>
<form>
<select size="8" name="SelectMultipla" multiple="multiple">
<%
valore_strVariabile = Request.QueryString("SelectMultipla")
If len(valore_strVariabile) = 0 then
%>
<option value="">Seleziona un valore</option>
<option value="10">10</option>
<option value="100">100</option>
<option value="150">150</option>
<%
Else
If InStr(valore_strVariabile,",") > 0 then
valore_strVariabile = Replace(valore_strVariabile," ","")
elementi = split(valore_strVariabile,",")
Else
elementi = array(valore_strVariabile)
End If
%>
<option value="">Seleziona un valore</option>
<option value="10"<%=SELECTED("10", elementi)%>>10</option>
<option value="100"<%=SELECTED("100", elementi)%>>100</option>
<option value="150"<%=SELECTED("150", elementi)%>>150</option>
<%
End If
%>
</select>
<input type="submit" value="vai" />
</form>