日期:2014-05-17  浏览次数:20875 次

select的问题
<option   value= " "> —请选择— </option>
        <%  
      selected= " "
      for   i   =   0   to   ubound(otherdesc)
      if   rs( "thesource ")   =   otherdesc(i)   then   selected   =   "selected "
response.Write( " <option   value= ' "&otherdesc(i)& " '   "&selected& "> "&otherdesc(i)& " </option> ")
selected= " "
    next
    set   toconn=nothing
    %>
        </select>
我一直是用这个
但老觉得应该有更好的办法
不知道谁能说说呢


------解决方案--------------------
应该没什么更好的方法了~
------解决方案--------------------
if rs.eof then exit for
next
------解决方案--------------------
<Select size= "1 " name= "thesource ">
<Option value= " " Selected> 全部
<%Set RS=Conn.Execute( "select thesource from thesourcetable ")
Do While NOT Rs.EOF%>
<Option value= " <%=Rs(0)%> "> <%=Rs(1)%>
<% Rs.movenext
Loop
Rs.close%>
</Select>

這樣也可以哦!
------解决方案--------------------
一般情况下都是这样的