如果是asp,可以这样写:
<SELECT class="Inputselect" style="WIDTH: 80px" name=sltPcs>
<%
while not rspcs.EOF
%>
<OPTION value=<%=rspcs("pcs_no")%>
<%
DIM s
s=Request.QueryString("PCS")
if LEN(s)>0 and cstr(rspcs("pcs_no"))=s then
Response.Write(" selected ")
end if
%>><%=trim(rspcs("pcs_name"))%></OPTION>
<%
rspcs.MoveNext
wend
%>
</SELECT>
<SELECT class="Inputselect" style="WIDTH: 80px" name=sltPcs>
<%
while not rspcs.EOF
%>
<OPTION value=<%=rspcs("pcs_no")%>
<%
DIM s
s=Request.QueryString("PCS")
if LEN(s)>0 and cstr(rspcs("pcs_no"))=s then
Response.Write(" selected ")
end if
%>><%=trim(rspcs("pcs_name"))%></OPTION>
<%
rspcs.MoveNext
wend
%>
</SELECT>
DIM s
s=Request.QueryString("PCS")
改为:
s=用户选择的省份
selectedIndex = ***或者html:
<option selected>****</option>
然后用循环
<SELECT>
<%
for i=0 to 23
if myarr(i)=rs("sheng") then
%>
<option selected><%=myarr(i)%></option>
<%
Else
%>
<option><%=myarr(i)%></option>
<%
Next
%>