标题:关于asp代码中下拉列表框选择一次值后,下次能记住这个值,不用再次选择问题 ...
只看楼主
nxwlzx
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2015-6-26
 问题点数:0 回复次数:0 
关于asp代码中下拉列表框选择一次值后,下次能记住这个值,不用再次选择问题
这是一段asp的代码, 现在的问题是:
想让“品牌”下拉列表框(所有选项值是从数据库一个表中获得的)选择一次后,下次再打开这个页面的时候,能记住上一次选择的值,不用再选择!
如何实现,请高手帮忙修改代码,谢谢!

sub addall()

dim ex_number2
Set rs = server.CreateObject("Adodb.RecordSet")
sql="Select ex_number from "&web_dbtop&"shop Order by ex_number desc"
rs.open sql,Conn,1,1
if not rs.eof then
    ex_number = rs("ex_number")
    ex_number2 = ex_number+1
else
    ex_number2 = 1
end if
rs.close
set rs = nothing
%>
<TABLE width="96%" border=0 align=center cellpadding="4" cellSpacing=1 class=tbtitle style="BACKGROUND: #cad9ea;">
<form action="?action=saddall" method="post" name="form" id="form" onSubmit="return Validator.Validate(this,3)">
  <tr>
    <td width="20%" align="left" bgcolor="#F5FAFE">编 号:</td>
    <td width="80%" bgcolor="#FFFFFF"><INPUT id="ex_number" size=10 value="<%=ex_number2%>" name="ex_number" dataType="Number" msg="" style="text-align:center"></td>
  </tr>
  <tr>
    <td align="left" bgcolor="#F5FAFE">号 码:</td>
    <td bgcolor="#FFFFFF"><textarea name="ex_phone" id="ex_phone" cols="60" rows="15" dataType="Require" msg=""></textarea>
      严格按豆号或回车隔开!</td>
  </tr>
  <tr>
    <td align="left" bgcolor="#F5FAFE">类 型:</td>
    <td bgcolor="#FFFFFF">
      <select name="ex_good" id="ex_good">
        <option value="0">普通</option>
        <option value="1">靓号</option>
        <option value="2">零月租</option>
      </select>
    </td>
  </tr>
  <tr>
    <td bgcolor="#F5FAFE">首页显示:</td>
    <td bgcolor="#FFFFFF"><select name="ex_index" id="ex_index">
        <option value="0">暂不</option>
        <option value="1">推荐</option>
        <option value="2">经典</option>
        <option value="3">特价</option>
      </select></td>
  </tr>
  <tr>
    <td bgcolor="#F5FAFE">销售情况:</td>
    <td bgcolor="#FFFFFF"><select name="ex_sales" id="ex_sales">
        <option value="0">销售中</option>
        <option value="1">订购中</option>
        <option value="2">已销售</option>
      </select></td>
  </tr>
  <tr>
    <td bgcolor="#F5FAFE">内含话费:</td>
    <td bgcolor="#FFFFFF">¥
      <INPUT name="ex_cost" id="ex_cost" value="" size=20  dataType="Require" msg=""></td>
  </tr>
  <tr>
    <td bgcolor="#F5FAFE">购买价格:</td>
    <td bgcolor="#FFFFFF">¥
      <INPUT name="ex_price" id="ex_price" value="" size=20  dataType="Require" msg=""></td>
  </tr>
  <tr>
    <td bgcolor="#F5FAFE">最低消费:</td>
    <td bgcolor="#FFFFFF">¥
      <INPUT name="ex_low" id="ex_low" value="" size=20  dataType="Require" msg=""></td>
  </tr>
  <tr>
    <td bgcolor="#F5FAFE">详细介绍:</td>
    <td bgcolor="#FFFFFF">
      <textarea name="ex_name" cols="50" rows="10" id="ex_name"></textarea></td>
  </tr>
    <TR>
      <TD rowspan="2" bgColor=#f5fafe>品 牌:</TD>
      <TD bgColor=#ffffff><input name="ex" type="radio" value="no" onClick="javascript:ShowMenu(0)" checked="checked" />
默认&nbsp;&nbsp;
<input type="radio" name="ex" value="yes" onClick="javascript:ShowMenu(1)" />
自定义</TD>
    </TR>
    <TR>
      <TD bgColor=#ffffff><table width="100%" border="0" align="right" cellpadding="2" cellspacing="1">
        <tr id="edit_">
          <td><select name="brand_id" id="brand_id">
              <%
Set rs_brand = Server.CreateObject("ADODB.Recordset")
sql = "select ex_title,brand_id from "&web_dbtop&"brand Order by brand_id desc"
rs_brand.Open sql,conn,1,1
Do While Not rs_brand.eof
%>
              <option value="<%=rs_brand("brand_id")%>"><%=rs_brand("ex_title")%></option>
              <%
rs_brand.movenext
Loop
rs_brand.close:Set rs_brand = Nothing
%>
          </select></td>
        </tr>
        <tr id="del_">
          <td><input type="hidden" name="ex_content" value="暂无内容">
              <iframe id="eWebEditor1" src="ewebeditor/ewebeditor.htm?id=ex_content&style=blue" frameborder="0" scrolling="no" width="550" height="350"></iframe></td>
        </tr>
      </table></TD>
    </TR>
  <tr>
    <td bgcolor="#F5FAFE">审 核:</td>
    <td bgcolor="#FFFFFF"><input name="ex_check" type="radio" id="radio" value="1" checked>
        <font color="#009900">已通过</font>
        <input type="radio" name="ex_check" id="radio" value="0">
        <font color="#FF0000">审核中</font></td>
  </tr>
  <tr>
    <td bgcolor="#F5FAFE">录入时间:</td>
    <td bgcolor="#FFFFFF"><INPUT id="ex_time" size=20 value="<%=date()%>" name="ex_time"></td>
  </tr>
  <tr>
    <td colspan="2" align="center" bgcolor="#F5FAFE">
    <INPUT class=inputbut type=submit value=批量添加 name=Submit>
      重复号码将自动更新!</td>
    </tr>
   </form>
</table>
<%
end sub

2015-06-26 11:19



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-454741-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.061997 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved