ASP中读取下拉菜单选择中的默认值怎么读
<selectname="ModelTheme"id="ModelTheme"><%'搜索模块setrs_t=server.createobject("adodb.rec...
<select name="ModelTheme" id="ModelTheme">
<% '搜索模块
set rs_t=server.createobject("adodb.recordset")
sql_t="select Web_ThemeID from web_settings"
rs_t.open(sql_t),cn,1,1
Web_ThemeID=rs_t("Web_ThemeID")
rs_t.close
set rs_t=nothing
%>
<option>请选择分类</option>
<% set rs_1=server.createobject("adodb.recordset")
sql="select [name],[id] from web_theme where view_yes=1"
rs_1.open(sql),cn,1,1
do while not rs_1.eof
response.write "<option value='"&rs_1("id")&"'>"&rs_1("name")&"</option>"
rs_1.movenext
loop
rs_1.close
set rs_1=nothing
%> </select> 展开
<% '搜索模块
set rs_t=server.createobject("adodb.recordset")
sql_t="select Web_ThemeID from web_settings"
rs_t.open(sql_t),cn,1,1
Web_ThemeID=rs_t("Web_ThemeID")
rs_t.close
set rs_t=nothing
%>
<option>请选择分类</option>
<% set rs_1=server.createobject("adodb.recordset")
sql="select [name],[id] from web_theme where view_yes=1"
rs_1.open(sql),cn,1,1
do while not rs_1.eof
response.write "<option value='"&rs_1("id")&"'>"&rs_1("name")&"</option>"
rs_1.movenext
loop
rs_1.close
set rs_1=nothing
%> </select> 展开
展开全部
<select name="ModelTheme" id="ModelTheme">
<% '搜索模块
set rs_t=server.createobject("adodb.recordset")
sql_t="select Web_ThemeID from web_settings"
rs_t.open(sql_t),cn,1,1
Web_ThemeID=rs_t("Web_ThemeID")
rs_t.close
set rs_t=nothing
%>
<option>请选择分类</option>
<% set rs_1=server.createobject("adodb.recordset")
sql="select [name],[id] from web_theme where view_yes=1"
rs_1.open(sql),cn,1,1
do while not rs_1.eof
response.write "<option value='"&rs_1("id")&"'"
if cstr(Web_ThemeID)=cstr(rs_1("id")) then response.write " selected"
response.write ">"&rs_1("name")&"</option>"
rs_1.movenext
loop
rs_1.close
set rs_1=nothing
%>
</select>
追问
------我的-------
value=""" & rs_1("id") & """"
if rs_1("id") = Web_ThemeID
------你的-------
value='"&rs_1("id")&"'"
if cstr(Web_ThemeID)=cstr(rs_1("id"))
-----------我是初学者,想了解一下你的和我的有什么不同?----------
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询