求助关于下拉框的问题!不是很明白!

Yjanuary 2004-01-12 02:13:58
<%
sql="select distinct top 1 WCRQ from SCTJ_SCWCRBMC order by wcrq desc"
set rs = server.createobject("ADODB.Recordset")
rs.open sql,dbconn,1,3

If Not rs.EOF Then rs.MoveFirst
While Not rs.EOF
%>
<%
dim wcrq
rq=rs("wcrq")
dim tmpYear,tmpMonth,tmpDay
tmpYear=left(rq,4)
tmpMonth=mid(rq,6,2)
tmpDay=right(rq,2)
%>
<%
rs.MoveNext
Wend
%>
<form method="POST" name="frmsearchworkplan" action="a.asp" target="top">
  
<select name="year" class="smallinput">
<%
dim y
for y= -5 to 5
if y = 0 then
response.write "<option selected>" & tmpYear + y
else
Response.write "<option>" & tmpYear + y
end if
next
%>
</select>年

<select name="month" class="smallinput">
<%
for y= 1 to 12

if y<10 then
pmtstr="0"&CStr(y)
else
pmtstr=CStr(y)
end if

if tmpMonth<10 then
tmpMonth="0"& tmpMonth
else
tmpMonth=tmpMonth
end if

if pmtstr = tmpMonth then
Response.write "<option selected>" & pmtstr
else
Response.write "<option>" & pmtstr
end if
next
%>
</select>月

<select name="day" class="smallinput">
<%
for y=1 to 31

if y<10 then
pmtstr="0"&CStr(y)
else
pmtstr=CStr(y)
end if

if pmtstr = tmpDay then
Response.write "<option selected>" & pmtstr
else
Response.write "<option>" & pmtstr
end if
next
%>
</select>日   

<input type="submit" value="提 交" name="B1" class="buttonface"></p>
</form>
下拉框初始值是从数据库中提出!
希望点击提交按钮后,下拉框的值为所选择的,应该怎么写??
...全文
95 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
PPLUNCLE 2004-01-12
  • 打赏
  • 举报
回复
http://expert.csdn.net/Expert/topic/2646/2646966.xml?temp=.7980158
Yjanuary 2004-01-12
  • 打赏
  • 举报
回复
只加这句吗?好象不行啊!
tmpMonth=cint(request("pmtstr")) '返回月份
还是不能保持啊!
my0707 2004-01-12
  • 打赏
  • 举报
回复
<select name="month" class="smallinput">
<%
for y= 1 to 12

if y<10 then
pmtstr="0"&CStr(y)
else
pmtstr=CStr(y)
end if

tmpMonth=cint(request("pmtstr")) '返回月份

if tmpMonth<10 then
tmpMonth="0"& tmpMonth
else
tmpMonth=tmpMonth
end if

if pmtstr = tmpMonth then
Response.write "<option selected>" & pmtstr & "</option>"
else
Response.write "<option>" & pmtstr & "</option>"
end if
next
%>
</select>月

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧