asp下拉列表动态内容取值问题
<trbgcolor="#FFFFFF"><tdwidth="10%"height="25"align="right">类 ...
<tr bgcolor="#FFFFFF">
<td width="10%" height="25" align="right">类 别:</td>
<td width="628"><select name="sort_id" id="sort_id" dataType="Require" msg="请选择产品类别!">
<option selected>请选择</option>
<% set rs1=server.CreateObject("adodb.recordset")
sql="select id,sort from product_sort order by sx asc"
rs1.open sql,conn,1,1
do while not rs1.eof %>
<option value="<%= rs1("id") %>"><%= rs1("sort") %></option>
<% rs1.movenext
loop
rs1.close
set rs1=nothing
sort=Trim(Request.Form("sort_id"))
%>
</select> <font color="red">*</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="25" align="right">标 题:</td>
<td><input size="35" name="product_sort" type="text" class="form2" id="product_sort"> <font color="red">*</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="25" align="right">图 片:</td>
<td>
<input type="hidden" name="small_img" value="">
<iframe name="ad" frameborder=0 width=100% height=40 scrolling=no src=upfile\upload3.asp></iframe> </td>
</tr>
我想实现的功能就是当下拉列表值为4的时候,才显示出图片那一行的内容,如果是其他的值,则不显示!
数据库内rs1("id")的值是int的,rs1("sort")的值是varchar的!
请问怎么能实现?? 展开
<td width="10%" height="25" align="right">类 别:</td>
<td width="628"><select name="sort_id" id="sort_id" dataType="Require" msg="请选择产品类别!">
<option selected>请选择</option>
<% set rs1=server.CreateObject("adodb.recordset")
sql="select id,sort from product_sort order by sx asc"
rs1.open sql,conn,1,1
do while not rs1.eof %>
<option value="<%= rs1("id") %>"><%= rs1("sort") %></option>
<% rs1.movenext
loop
rs1.close
set rs1=nothing
sort=Trim(Request.Form("sort_id"))
%>
</select> <font color="red">*</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="25" align="right">标 题:</td>
<td><input size="35" name="product_sort" type="text" class="form2" id="product_sort"> <font color="red">*</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="25" align="right">图 片:</td>
<td>
<input type="hidden" name="small_img" value="">
<iframe name="ad" frameborder=0 width=100% height=40 scrolling=no src=upfile\upload3.asp></iframe> </td>
</tr>
我想实现的功能就是当下拉列表值为4的时候,才显示出图片那一行的内容,如果是其他的值,则不显示!
数据库内rs1("id")的值是int的,rs1("sort")的值是varchar的!
请问怎么能实现?? 展开
展开全部
<script type="text/javascript">
function hh(t){
if(t.value==4){
document.getElementById("pic1").setAttribute("className","s");
document.getElementById("pic2").setAttribute("className","s");
document.getElementById("pic1").setAttribute("class","s");
document.getElementById("pic2").setAttribute("class","s");
}
else{
document.getElementById("pic1").setAttribute("className","h");
document.getElementById("pic2").setAttribute("className","h");
document.getElementById("pic1").setAttribute("class","s");
document.getElementById("pic2").setAttribute("class","s");
}
}
</script>
<style type="text/css">
.s{}
.h{visibility:hidden; display:none}
</style>
<table>
<tr bgcolor="#FFFFFF">
<td width="10%" height="25" align="right">类 别:</td>
<td width="628">
<select name="sort_id" id="sort_id" dataType="Require" msg="请选择产品类别!" onchange="hh(this)">
<option selected>请选择</option>
<% set rs1=server.CreateObject("adodb.recordset")
sql="select id,sort from product_sort order by sx asc"
rs1.open sql,conn,1,1
do while not rs1.eof %>
<option value="<%= rs1("id") %>"><%= rs1("sort") %></option>
<% rs1.movenext
loop
rs1.close
set rs1=nothing
sort=Trim(Request.Form("sort_id"))
%>
</select>
<font color="red">*</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="25" align="right">标 题:</td>
<td><input size="35" name="product_sort" type="text" class="form2" id="product_sort"> <font color="red">*</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="25" align="right" id="pic1" class="h">图 片:</td>
<td id="pic2" class="h">
<input type="hidden" name="small_img" value="">
<iframe name="ad" frameborder=0 width=100% height=40 scrolling=no src=upfile\upload3.asp>
</iframe>
</td>
</tr>
</table>
function hh(t){
if(t.value==4){
document.getElementById("pic1").setAttribute("className","s");
document.getElementById("pic2").setAttribute("className","s");
document.getElementById("pic1").setAttribute("class","s");
document.getElementById("pic2").setAttribute("class","s");
}
else{
document.getElementById("pic1").setAttribute("className","h");
document.getElementById("pic2").setAttribute("className","h");
document.getElementById("pic1").setAttribute("class","s");
document.getElementById("pic2").setAttribute("class","s");
}
}
</script>
<style type="text/css">
.s{}
.h{visibility:hidden; display:none}
</style>
<table>
<tr bgcolor="#FFFFFF">
<td width="10%" height="25" align="right">类 别:</td>
<td width="628">
<select name="sort_id" id="sort_id" dataType="Require" msg="请选择产品类别!" onchange="hh(this)">
<option selected>请选择</option>
<% set rs1=server.CreateObject("adodb.recordset")
sql="select id,sort from product_sort order by sx asc"
rs1.open sql,conn,1,1
do while not rs1.eof %>
<option value="<%= rs1("id") %>"><%= rs1("sort") %></option>
<% rs1.movenext
loop
rs1.close
set rs1=nothing
sort=Trim(Request.Form("sort_id"))
%>
</select>
<font color="red">*</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="25" align="right">标 题:</td>
<td><input size="35" name="product_sort" type="text" class="form2" id="product_sort"> <font color="red">*</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="25" align="right" id="pic1" class="h">图 片:</td>
<td id="pic2" class="h">
<input type="hidden" name="small_img" value="">
<iframe name="ad" frameborder=0 width=100% height=40 scrolling=no src=upfile\upload3.asp>
</iframe>
</td>
</tr>
</table>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
用JAVASCRIPT,自己去查代码,就是显示隐藏互相转换的代码,改一下就行了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
为什么不用javascript代码呀 也简单
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询