下拉框

xk8023ppt 2009-08-05 01:53:18
<!--#include file="conn.asp" -->
<%

if Request("fromSubmit")="submit" then

dep = Request("depart1")
wm = Request("workname")
rk = Request("remark")
st = Request("start")
ed = Request("end")
tm = request("time")

set rs1=server.createobject("adodb.recordset")
rs1.Open "select * from offer",conn,3,3
rs1.AddNew
rs1("depart") = dep
rs1("workname") = wm
rs1("remark") = rk
rs1("start") = st
rs1("end") = ed
rs1("time") = tm
rs1.Update
conn.close
set conn=nothing
response.redirect("offer.asp")
end if
%>


<script language="javascript" src="date.js" ></script>

<script language="javascript">

var oCalendarEn=new PopupCalendar("oCalendarEn"); //初始化控件时,请给出实例名称如:oCalendarEn
oCalendarEn.Init();

var oCalendarChs=new PopupCalendar("oCalendarChs"); //初始化控件时,请给出实例名称:oCalendarChs
oCalendarChs.weekDaySting=new Array("日","一","二","三","四","五","六");
oCalendarChs.monthSting=new Array("一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月");
oCalendarChs.oBtnTodayTitle="今天";
oCalendarChs.oBtnCancelTitle="取消";
oCalendarChs.Init();
</script>
<html>
<head> <title></title><meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head><body bgcolor="#FFFFFF"><p align="center"><font size="5"></font></p>
<form method="post" action="offer.asp?fromSubmit=submit">

<div align="center">
<table width="46%" border="0">
<tr>
<td width="28%">
<div align="right">部门:</div>
</td>
<td width="72%">
<%
set rs = Server.CreateObject("ADODB.recordset")
rs.Open "SELECT depart FROM [depart]", conn,1,1

%>
<select id="depart1" >
<option value=" <%=rs("depart")%>"> <%=rs("depart")%> </option>
</select>
</td>
</tr>
<tr>
<td width="28%">
<div align="right">工作名称: </div>
</td>
<td width="72%">
<input type="text" name="workname">
</td>
</tr>
<tr>
<td width="28%">
<div align="right">备注: </div>
</td>
<td width="72%">
<input type="text" name="remark">
</td>
</tr>
<tr>
<td width="28%">
<div align="right">开始日期: </div>
</td>
<td width="72%">
<input type ="text" name="start" onclick="getDateString(this,oCalendarChs)" readonly>
</td>
</tr>
<tr>
<td width="28%">
<div align="right">结束日期: </div>
</td>
<td width="72%">
<input type ="text" name="end" onclick="getDateString(this,oCalendarChs)" readonly>
</td>
</tr>
<tr>
<td width="28%">
<div align="right">耗费时间: </div>
</td>
<td width="72%">
<input type="text" name="time">
</td>
</tr>
<tr>
<td width="28%">
<div align="right"> </div>
</td>
<td width="72%">
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="reset" value="Reset">
</td>
</tr>
</table>
</div>
</form>

<%
exec="select * from offer "
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,1
%>
<table width="62%" border="0" align="center" cellpadding="0" cellspacing="0">
<td>部门</td>
<td>任务名称</td>
<td>备注</td>
<td>开始时间</td>
<td>结束时间</td>
<td>耗费时间</td>
<%do while not rs.eof%><tr>
<td><%=rs("depart")%></td>
<td><%=rs("workname")%></td>
<td><%=rs("remark")%></td>
<td><%=rs("start")%></td>
<td><%=rs("end")%></td>
<td><%=rs("time")%></td>
</tr><%
rs.movenext
loop
%>
</table>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
</body>
</html>

我想从depart表中把depart列的值给下拉框
可是现在不对
...全文
41 点赞 收藏 3
写回复
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
bsk_bg 2009-08-05
<%
set rs = Server.CreateObject("ADODB.recordset")
rs.Open "SELECT depart FROM [depart]", conn,1,1

%>
<select id="depart1" >
<%do while not rs.eof %>
<option value=" <%=rs("id")%>"> <%=rs("depart")%> </option>
<%
rs.movenext
loop
rs.close

%>
</select>
回复
xk8023ppt 2009-08-05
具体怎么做 教教我 我是新手
回复
bsk_bg 2009-08-05
depart 列用select 表示。再做一个循环就可以了
回复
发动态
发帖子
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
社区公告
暂无公告