28,391
社区成员
发帖
与我相关
我的任务
分享
<!--#include file="inc_common_all.asp"-->
<!--#include file="UBB.asp"-->
<%
pagename="电视墙实景图"
call bodySkin()
sub pageContent()
showMsg()
end sub
function showMsg()
sql="select * from dianshiqiang"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
dim x_chicun,x_id
x_chicun =rs("chicun")
x_id=rs("id")
%>
101室:
<table border=1 width='30%' cellspacing=1 align=left cellpadding=3>
<tr align="center">
<td><% response.write x_chicun %></td> //有什么办法能写成ID为1的那行数据的x_chicun?
<td><% response.write x_chicun %></td> //有什么办法能写成ID为2的那行数据的x_chicun?
</tr>
<tr class="title2" align="center">
<td><% response.write x_chicun %></td> //有什么办法能写成ID为3的那行数据的x_chicun?
<td><% response.write x_chicun %></td> //有什么办法能写成ID为4的那行数据的x_chicun?
</tr>
</table>
<br><br><br><br><br>
102室:
<table border=1 width='45%' cellspacing=1 align=left cellpadding=3 >
<tr align="center">
<td><% response.write x_chicun %></td> //有什么办法能写成ID为5的那行数据的x_chicun?
<td><% response.write x_chicun %></td> //有什么办法能写成ID为6的那行数据的x_chicun?
<td><% response.write x_chicun %></td> //有什么办法能写成ID为7的那行数据的x_chicun?
</tr>
<tr class="title2" align="center">
<td><% response.write x_chicun %></td> //有什么办法能写成ID为8的那行数据的x_chicun?
<td><% response.write x_chicun %></td> //有什么办法能写成ID为9的那行数据的x_chicun?
<td><% response.write x_chicun %></td> //有什么办法能写成ID为10的那行数据的x_chicun?
</tr>
</table>
<%
rs.close
set rs=nothing
end function
%>
<%
showMsg()
function showMsg()
set roomrs=conn.execute("select distinct fangjian from yangji_bak")'得到房间号
sql="select * from yangji_bak"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
dim x_chicun,x_fangjian,x_weizhi
dim arr
while not roomrs.eof'循环房间号
redim arr(5)'重新定义数组请清楚上一次的数据,用于存储位置数据,如下图
'0(左上) 1(中上) 2(右上)
'3(左下) 4(中下) 5(右下)
'下面2个变量记录上下有多少个格子,好进行合并
tdup=0
tddown=0
x_fangjian=roomrs(0)
rs.Filter="fangjian='"&x_fangjian&"'"'执行过滤得到此房间的数据
while not rs.eof'填充位置数组
x_chicun =rs("chicun")
x_weizhi =rs("weizhi")
if instr(x_weizhi,"左上")<>0 then
arr(0)=x_chicun
tdup=tdup+1
elseif instr(x_weizhi,"中上")<>0 then
arr(1)=x_chicun
tdup=tdup+1
elseif instr(x_weizhi,"右上")<>0 then
arr(2)=x_chicun
tdup=tdup+1
elseif instr(x_weizhi,"左下")<>0 then
arr(3)=x_chicun
tddown=tddown+1
elseif instr(x_weizhi,"中下")<>0 then
arr(4)=x_chicun
tddown=tddown+1
elseif instr(x_weizhi,"右下")<>0 then
arr(5)=x_chicun
tddown=tddown+1
end if
rs.movenext
wend
%>
<% response.write x_fangjian %>:<br />
<table border=1 width='45%' cellspacing=1 align=left cellpadding=3 bordercolor=#ad8c42 style=BORDER-COLLAPSE: collapse;>
<tr class="title2" align="center">
<%
'用于计算上下td不一致时如何合并
upcolspan=""
downcolspan=""
if tdup<>tddown then
if tdup=3 then'上3下2
upcolspan=" colspan='2'"
downcolspan=" colspan='3'"
else'上2下3
upcolspan=" colspan='3'"
downcolspan=" colspan='2'"
end if
end if
'输出上面的数据行
for i=0 to 2
if arr(i)<>"" then response.write "<td"&upcolspan&">"&arr(i)&"</td>"
next
%>
</tr>
<tr class="title2" align="center">
<%
'输出下面的数据行
for i=3 to 5
if arr(i)<>"" then response.write "<td"&downcolspan&">"&arr(i)&"</td>"
next
%>
</tr>
</table>
<br><br><br><br><br>
<%
roomrs.movenext
wend
roomrs.close
set roomrs=nothing
rs.close
set rs=nothing
end function
%>