用循环做课程表输出表格

王朝asp·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

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

效果图

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

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航