欢迎光临
我们一直在努力

用循环做课程表输出表格-ASP教程,数据库相关

建站超值云服务器,限时71元/月

最近在做一个实验、机房预约系统,最开始用的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>

效果图

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

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 用循环做课程表输出表格-ASP教程,数据库相关
分享到: 更多 (0)

相关推荐

  • 暂无文章