再问 提交动态表单的问题

chilun 2008-10-10 09:13:01
我正在试着做一个自习室在线占座系统,首先在数据库中为教室建一个表,定义好课桌编号,是否被占座等信息,然后在一个页面中以输出按钮的方式显示这些座位,占位者只需要点击相应的按钮即可占位。现在有一个问题:所有的按钮都是动态生成的,而且占位者的选择可能是任意座位,那么该如何给按钮命名才能传递到处理页面中呢?请大家指点~

发代码:

dim i,j,sr1,aq1
i = 1
j = 1
sr1 = "select * from seats"
set aq1 = conn.execute(sr1)
response.write "<table width=99px height=99px align=center >"
if not (aq1.bof and aq1.eof) then


for i = 1 to 3
response.write "<tr>"
for j = 1 to 3
if aq1("seatstate") = 0 then
imageurl = "images/1.gif"
altmess = "未被预订!"
else
imageurl = "images/2.jpg"
altmess = "已被预订!"
end if
response.write "<td width=33px height=33px align=center><form name=form1 method=post action=display.asp><input src=" & imageurl & " type=image name=input1 value=" & aq1("seatno") & " alt=" & altmess & "/></form>座位</td><td width=33px align=center></td><td width=33px align=center></td>"
aq1.movenext
next
response.write "</tr>"
next
response.write "</table>"
end if
conn.close
set aq1 = nothing
...全文
91 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
chilun 2008-10-21
  • 打赏
  • 举报
回复
多谢各位的解答~按5楼朋友的办法解决了。
jankrong 2008-10-11
  • 打赏
  • 举报
回复
这样看可以不?

<%
dim i,j,sr1,aq1
i = 1
j = 1
sr1 = "select * from seats"
set aq1 = conn.execute(sr1)
response.write "<table width=99px height=99px align=center >"
if not (aq1.bof and aq1.eof) then


for i = 1 to 3
response.write "<tr>"
for j = 1 to 3
if aq1("seatstate") = 0 then
imageurl = "images/1.gif"
altmess = "未被预订!"
codes="input type=image"'如果未被预订则以表单标签形式输出,能提交表单
else
imageurl = "images/2.jpg"
altmess = "已被预订!"
codes="img"'如果已被预订则以图片形式直接输出,不能提交表单
end if

response.write "<td width=33px height=33px align=center><form name=form1 method=post action=display.asp>"
Response.Write"<"&codes&" src=" & imageurl & " alt=" & altmess & "/>"'调用上面的判断,看起是否被预订
Response.Write"<input name=""seatno"" type=""hidden"" value="""&aq1("seatno")&""" />"'隐藏课桌编号值。
Response.Write"</form></td><td width=33px align=center></td><td width=33px align=center></td>"
aq1.movenext
next
response.write "</tr>"
next
response.write "</table>"
end if
conn.close
set aq1 = nothing


%>

什么都不能 2008-10-11
  • 打赏
  • 举报
回复
思路不对
可以设定教学楼,教室内容,课桌编号每个教室都可以从0001~9999 定,选定哪个位子下面的building ,room,seat 就指定到具体的教学楼,教室,座位,接收数据就按building,room,seat接收就可以。
<input type="hidden" name="building" value="<%=rs("building")%>"/> 教学楼名称
<input type="hidden" name="room" value="<%=rs("room") %> />教室
<input type="hidden" name="seat" value="" />
<table
....
<input type="button" class="seat_1" value="<%=rs("seat") %>" onclick="chooseSeat('<%=rs("seat")%>')">
chilun 2008-10-10
  • 打赏
  • 举报
回复
2楼的朋友给个简单的例子吧~
neo_yoho 2008-10-10
  • 打赏
  • 举报
回复

<script language="JavaScript">
function submitform(v)
{
alert("占了"+v+"座位")
document.classroom.action="提交的页面"+"?classroom=4&desk="+v;//这里是提交的教室与所站座位
document.classroom.submit();
}
</script>
<form method=post name="classroom" action="">
<input type="button" value="1#" onclick="submitform(this.value)">
<input type="button" value="2#" onclick="submitform(this.value)">
<input type="button" value="3#" onclick="submitform(this.value)">
<input type="button" value="4#" onclick="submitform(this.value)">
<input type="button" value="5#" onclick="submitform(this.value)">
</form>

不细看了 用这样提交的BUTTON提交方式就行了
  • 打赏
  • 举报
回复
动态提交表单?
得利用一个中间的变量来才可以实现你要的这个功能
chilun 2008-10-10
  • 打赏
  • 举报
回复
没有换行。。。影响阅读,我好像没有权限编辑帖子吧?

28,391

社区成员

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

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