ASP动态画表格
时间:2010-06-28 来源:mx11
<%
dim i,j
dim iRsCount,iRows,strpicd
dim perLines
perLines=2 '每行需显示的列数
strpicd="select * from v_web_news where c_name='"&cname2&"' and npic is not null order by id desc"
set objRs=Server.CreateObject("ADODB.RecordSet")
objRs.open strpicd,conn,1,1
if not objRs.eof then
response.write "<table border=""0"" width=""100%"" cellpadding=""0"" cellspacing=""1"" >"&vbcrlf
iRsCount=objRs.recordcount '取得实际的记录数
iRows=int(iRsCount/perLines) '计算可得到的行数
if iRows<1 then
iRows=1
else
if iRsCount mod perLines=0 then
iRows=int(iRsCount/perLines)
else
iRows=int(iRsCount/perLines)+1
end if
end if
i=1
while not objRs.eof
for i=1 to iRows
response.write "<tr>"&vbcrlf
for j=1 to perLines
If Not objRs.eof then
'response.write "<td width=""25%""><div align=""left""><a href=""123.asp""><font color=green>["&objRs("nTitle")&"] </font>"&lEFT(trim(RemoveHTML(objRs("nHtmlText"))),36)&"</a></div></td>"&vbcrlf
response.write "<td width=""25%""><div align=""left""><a href=""picshow.asp?id="&objRs("ID")&"&mnid=" & objRs("mn_id") &"&classname=" & objRs("c_name") & " target=""_blank""><font color=green>["&objRs("nTitle")&"] </font>"&lEFT(trim(RemoveHTML(objRs("nHtmlText"))),36)&"</a></div></td>"&vbcrlf
Else
response.write "<td> </td>"&vbcrlf
End if
if not objRs.eof then objRs.movenext
next
response.write "</tr>"&vbcrlf
'---
response.write "<tr>"&vbcrlf
response.write "<td height=""1"" background=""images/line.jpg""></td>"&vbcrlf
response.write "<td height=""1"" background=""images/line.jpg""></td>"&vbcrlf
response.write "</tr>"&vbcrlf
'---
next
Wend
response.write "</table>"
end if objRs.close
set objRs=nothing
%>
dim i,j
dim iRsCount,iRows,strpicd
dim perLines
perLines=2 '每行需显示的列数
strpicd="select * from v_web_news where c_name='"&cname2&"' and npic is not null order by id desc"
set objRs=Server.CreateObject("ADODB.RecordSet")
objRs.open strpicd,conn,1,1
if not objRs.eof then
response.write "<table border=""0"" width=""100%"" cellpadding=""0"" cellspacing=""1"" >"&vbcrlf
iRsCount=objRs.recordcount '取得实际的记录数
iRows=int(iRsCount/perLines) '计算可得到的行数
if iRows<1 then
iRows=1
else
if iRsCount mod perLines=0 then
iRows=int(iRsCount/perLines)
else
iRows=int(iRsCount/perLines)+1
end if
end if
i=1
while not objRs.eof
for i=1 to iRows
response.write "<tr>"&vbcrlf
for j=1 to perLines
If Not objRs.eof then
'response.write "<td width=""25%""><div align=""left""><a href=""123.asp""><font color=green>["&objRs("nTitle")&"] </font>"&lEFT(trim(RemoveHTML(objRs("nHtmlText"))),36)&"</a></div></td>"&vbcrlf
response.write "<td width=""25%""><div align=""left""><a href=""picshow.asp?id="&objRs("ID")&"&mnid=" & objRs("mn_id") &"&classname=" & objRs("c_name") & " target=""_blank""><font color=green>["&objRs("nTitle")&"] </font>"&lEFT(trim(RemoveHTML(objRs("nHtmlText"))),36)&"</a></div></td>"&vbcrlf
Else
response.write "<td> </td>"&vbcrlf
End if
if not objRs.eof then objRs.movenext
next
response.write "</tr>"&vbcrlf
'---
response.write "<tr>"&vbcrlf
response.write "<td height=""1"" background=""images/line.jpg""></td>"&vbcrlf
response.write "<td height=""1"" background=""images/line.jpg""></td>"&vbcrlf
response.write "</tr>"&vbcrlf
'---
next
Wend
response.write "</table>"
end if objRs.close
set objRs=nothing
%>
相关阅读 更多 +