我的一亩三分地 我就喜欢!
13fen  设为主页
 收藏本站
 
当前位置: > 一亩三分地:首页 > 网络学院 > 网络编程 > ASP专区 > Asp数据库/打印 > 用循环做课程表输出表格
热门文章排行
热门文章排行 手推车”功能的实现(10-07)
八大法则防范ASP网站漏洞(10-23)
ASP教程十一、调试ASP脚本(10-23)
在JSP中访问数据库大全(10-23)
虚机服务中常见Asp.Net低级错误一览(03-21)
精采文章排行
精采文章排行 ASP.NET实现抓取网页中的链接(11-15)
ASP连接数据库的11种方法(11-10)
如何动态创建网页的RSS内容摘要(11-10)
ASP网站漏洞及入侵防范方法(11-10)
ASP自定义函数:对字符串正则替换(11-10)
技术专题推荐
网管论坛交流
 

用循环做课程表输出表格 

作者:佚名   来源:一亩三分地   点击:   日期:2007-03-23

最近在做一个实验、机房预约系统,最开始用的dreamwaver做的表格,很大,而且程序共有3000多行,很不方便管理和修改~

最近用循环和判断做了一个输出表格,源程序如下

<table border="1" cellspacing="0" bordercolor="#006699">

<%
hang=41 '行变量
lie=9 '列变量
leirong=blie&"&nbsp"&bhang
for bhang=1 to hang
response.write("<tr>")
'------------------------------------------------控制星期开始
for blie=1 to lie
if bhang=1 then
if blie=1 then
response.Write("<td colspan=2 width=108>第"&weektime&"周")
else
if not blie=9 then
response.Write("<th width=93>")
xqnotemp=blie-1
if xqnotemp=1 then xqno="一"
if xqnotemp=2 then xqno="二"
if xqnotemp=3 then xqno="三"
if xqnotemp=4 then xqno="四"
if xqnotemp=5 then xqno="五"
if xqnotemp=6 then xqno="六"
if xqnotemp=7 then xqno="日"
response.Write("星期"&xqno)
response.write("</th>")
end if
end if
else
if ((bhang+2) mod 4)=0 and blie=1 then
response.Write("<td rowspan=4>"&(bhang+2)/4&"小节")
response.Write("&nbsp;")
response.write("<td>")
response.write("实验名称")
response.write("</td>")
else
if not blie=9 then
'------------------------------控制实验名称、班级、任课教师内容开始
if (not blie=1) and ((bhang+2) mod 4=0) then
response.write("<td rowspan=4>")
response.write("<table><tr>")
rs.open "select * from lesson",conn,1,1
' response.write(rs("day"))
rs.close
response.write("<td></td></tr></table>")
response.write(blie-1&"&nbsp"&bhang)
response.write("</td>")
else
'------------------------------显示第二实验名称、班级、任课教师开始
if blie=1 then
response.Write("<td width=63 algin="&"center"&">")
if bhang mod 3=0 then
response.write("<span style=line-height:2; line-width: 20; vertical-align: top> <font style=font-size:9pt> 班级</font></span>")
elseif bhang mod 4=0 then
response.write("任课教师")
else
response.write("人数")
end if
response.Write("</td>")
end if
'------------------------------显示第二实验名称、班级、任课教师结束
end if
'------------------------------控制实验名称、班级、任课教师内容结束
end if
end if
end if

next
'---------------------------------------------------控制星期结束
response.write("</tr>")
next

%>
</table>



效果图


单元格内的数字通过两个数字来定位,以数字为查询条件,即可从数据库中查询,并显示出来!



文章评论】 【收藏本文】 【推荐好友】 【打印本文】 【论坛讨论

   相关文章:
·ASP中巧用Response属性 ·第六课:ASP脚本循环语句
·在 Web 页上使用条件数值格式 ·连接数据库查询手册(不仅仅适用于asp)
·警惕"给你的FileSystemObject对象加把锁" ·用ASP做全文检索

   文章评论:(条)
  
 请留名: 匿名评论   点击查看所有评论 网管论坛
 

  责任编辑:一分  声明:刊登此文章是为了传递更多信息,文章内容仅供参考,转载请注明出处。