把数据库中的信息显示在下拉列表中
<% set rs=server.CreateObject("adodb.recordset") sql = "select * from cyte" rs.Open sql,conn,1,1 %> <select name="city"> <option value="">-- 请选择 --</option> <%do while not rs.eof%> <option value="<%=rs("cyte")%>" <% If city =rs("cyte") Then Response.write "selected"%>><%=rs("cyte")%></option> <% rs.movenext loop rs.close set rs=nothing %> </select>
把文本框中的信息显示在下拉列表中(信息之间用/隔开) <%if rs("chima")<>"" then%> <%size=trim(rs("chima"))%> <%myarr=split(size,"/")%> <select name="chima" id="chima"> <% for i=0 to ubound(myarr) %> <option value="<%=trim(myarr(i))%>" selected><%=trim(myarr(i))%></option> <%next%> </select> <%else response.write "无尺码信息" %> <%end if%>