1 <select name="s1">
2 <option id="o1" value="<%=day(daydate("d",-1,day(now)))%>" selected><%=day(daydate("d",-1,day(now)))%></option>
3 <option id="o2" value="<%=day(now)%>" selected><%=day(now)%></option>
4 </select>
现在默认是选择o2,我希望选择o1后提交完了,下拉框显示的还是o1的值,但是我在后面加上了下面这段代码后,如果选择o1,提交完了下拉列表就变成3项(2个o1和1个o2,选择o2时同理)
1 <%if request.Form("s1")<>"" then%>
2 <option value="<%=request.Form("s1")%>" selected><%=request.Form("s1")%></optin>
3 <%end if%>
这个应该怎么解决啊?
<select name="s1">
<option id="o1" value="<%=day(daydate("d",-1,day(now)))%>" <%= (day(daydate("d",-1,day(now)))==选中值)?"selected":"" %>><%=day(daydate("d",-1,day(now)))%></option>
<option id="o2" value="<%=day(now)%>" <%= (<%=day(now)==选中值)?"selected":"" %>><%=day(now)%></option>
</select>
这个很简单,你要用个隐藏域来保存你选中的值。或者你干脆就是用服务器控件就可以了。