一个关于selected的问题
下面是一个新闻分类编辑的页面,在编辑的时候我需要将属于这个新闻的类显示出来,以便编辑,但是如下面的做法是不可以的,有哪位老兄能出手相助啊?
小类:
<select name="Nclassid">
<%rs.open "select * from shop_news_nclass where anclassid="&selclass ,conn,1,1
if not(rs.eof and rs.bof) then
%>
<option selected value="<%=rs("NclassID")%>" ><%=rs("Nclass")%></option>
<% rs.movenext
do while not rs.eof%>
<option value="<%=rs("NclassID")%>" ><%=rs("Nclass")%></option>
<% rs.movenext
loop
end if
rs.close
set rs = nothing
%>
最后我提供一个思路:
<select name=txtclass ID=select3>
<option value=1 <%if rs("txtclass")=1 then%>selected<%end if%>>普通用户</option>
<option value=2 <%if rs("txtclass")=2 then%>selected<%end if%>>内部用户</option>
<option value=3 <%if rs("txtclass")=3 then%>selected<%end if%>>vip用户</option>
</select>
象以上的一个例子里是已知变量可能会有那几个值,作出判断是很容易的,但是在上一个例子里该怎么判断呢?这个应该是关键。