始祖鸟 的logo是什么:懂ASP程序的进来帮我看看这段代码?

来源:百度文库 编辑:查人人中国名人网 时间:2024/04/28 00:42:48
Sub newImgNews(sn,topicid,isDispTitle,isDispTxt,txtNum,w,h)
dim rs,sql,ids,i,cbs
ids=FindAllSub(topicId)
if right(ids,1)="," then ids=left(ids,len(ids)-1)
sql="Select top 8 Id,title,style,Thumbnail,CBS from (select * from znews where TopicID in("&ids&"))DERIVEDTBL where Examine=1 and IsDel<>1 and Thumbnail<>'' order by -id"
set rs=server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1,&H0000

IF NOT RS.EOF THEN
Response.Write "<TABLE align=center border=0 cellspacing=0 cellpadding=0 WIDTH=100% ><TR>"
DO WHILE NOT RS.EOF

Response.Write "<TD align=left WIDTH='140' height='104'><a href='article.asp?id="&rs("id")&"' target=_blank><img src='"&rs("Thumbnail")&"'"
if w&""<>"" then Response.write " width='"&w&"'"
if h&""<>"" then Response.write " height='"&h&"'"
Response.write "alt="""&rs("title")&""" border=0 align=left hspace=3 /></TD>"
RS.MOVENEXT
LOOP
Response.Write "<tr>"
rs.move 0,1
do while not rs.eof
if isDispTitle then Response.Write "<td height='20' align=left valign=top WIDTH='140'><a href='article.asp?id="&rs("id")&"' target=_blank>"&rs("title")&"</a>"
if isDispTxt then
cbs=rs("CBS")
if isnumeric(txtNum) and txtNum&""<>"0" then cbs=left(cbs,txtNum)
Response.write cbs&"..."
end If
Response.write"</a></td>"&VBCR
rs.movenext
loop

Response.Write "</TR></TABLE>"
END IF
rs.close
set rs=nothing
End Sub

这段代码,显示的是图片新闻栏目的图片列表。
目前的显示效果是图片横排的,如果图片多了,就把网页撑的很宽。。因为它没有判断一行只能显示几张图片。
我现在想加入一段代码,能够判断一行显示4张图片,到第5张自动换行显示。
请ASP高手帮我解决这个问题。
nnigou的回答太迅速了。。感动ing~~

不过,你让标题换行了,可是上面还有图片呢,图片没有换行啊。这样显示就乱了,图片和文字标题对应不上了。
本来是每张图片下面都有一个文字标题的。

Response.Write "<TD align=left WIDTH='140' height='104'><a href='article.asp?id="&rs("id")&"' target=_blank><img src='"&rs("Thumbnail")&"'"

Response.Write "<td height='20' align=left valign=top WIDTH='140'><a href='article.asp?id="&rs("id")&"' target=_blank>"&rs("title")&"</a>"

上面一段是图片,下面一段是文字标题啊。。。

do while not rs.eof
if isDispTitle then Response.Write "<td height='20' align=left valign=top WIDTH='140'><a href='article.asp?id="&rs("id")&"' target=_blank>"&rs("title")&"</a>"
if isDispTxt then
cbs=rs("CBS")
if isnumeric(txtNum) and txtNum&""<>"0" then cbs=left(cbs,txtNum)
Response.write cbs&"..."
end If
Response.write"</a></td>"&VBCR
rs.movenext
i=i+1
if i mod 4=0 then response.write "</tr><tr>"
loop

<%
sub showNews(sql,rows,cols,ipage,isShowBookMark,autoLen)
dim rs,page_size,icol,path
if cols="" or not isNumeric(cols) then cols = 1
if cols<=0 then cols = 1
if rows="" or not isNumeric(rows) then rows = 1
if rows<=0 then rows=1
if ipage="" or not isNumeric(ipage) then ipage=1
if ipage<=0 then ipage=1
if autoLen="" or not isNumeric(autoLen) then autoLen = 20
if autoLen<=0 then autoLen = 20

page_size = cols * rows
set rs = server.CreateObject("ADODB.recordset")
rs.open sql,conn,1,1
response.write "<table width=100% border=0 cellpadding=0 cellspacing=0 id=news>" & VBCRLF
if rs.eof or rs.bof then
response.write "<tr><td width=100% height=50 align=center valign=middle style='color:red'>暂时没有信息!</tr>" & VBCRLF
response.write "</table>" & VBCRLF
exit sub
end if
rs.pageSize = page_size
if int(ipage) > int(rs.pageCount) then ipage = rs.pageCount
rs.absolutePage = ipage

icol = 0
while not rs.eof and int(icol)<int(page_size)
if icol mod cols = 0 then
response.write "<tr>" & VBCRLF
end if
response.write "<td width=" & int(100/cols) & "% height=20 align=left valign=middle>" & VBCRLF
%>
<!新闻内容显示格式>
 ·<a href="readData.asp?id=<%=rs("id")%>&DataType=10001" target="_self"><%=autoCut(rs("title"),autoLen)%></a> <span id="time">[<%=DateValue(rs("post_time"))%>](已阅<%=rs("click_count")%>次)</span>
<!结束>
<%
response.write "</td>" & VBCRLF
icol = icol + 1
if icol mod cols = 0 then
response.write "</tr>" & VBCRLF
end if
rs.movenext
wend
if icol mod cols <> 0 then
response.write "<td colspan=" & int(cols - icol mod cols) & "> </td></tr>" & VBCRLF
end if
response.write "</table>"

if isShowBookMark=1 then

dim reg
set reg = new RegExp
reg.pattern = "[&]*page=[0-9]*"
reg.Global = true
reg.Ignorecase = true
path = reg.replace(request.QueryString,"")
if path="" then
path = "?" & path
else
path = "?" & path & "&"
end if
set reg = nothing

response.Write "<br><div style='font-size:12px;color:black'>" & VBCRLF
response.write "<br>总记录数<span style='color:red'>"&rs.recordCount&"</span>   每页<span style='color:red'>" & page_size & "</span>  "
if ipage <= 1 then
response.write "<span style='color:darkgray'>首页 前页</span>"
else
response.write "<a href=" & path & "page=1>首页</a> <a href=" & path & "page="&ipage-1&">前页</a>"
end if
if int(ipage) = int(rs.pageCount) then
response.write "<span style='color:darkgray'> 下页 末页</span>"
else
response.write " <a href=" & path & "page="&ipage+1&">下页</a> <a href=" & path & "page="&rs.pageCount&">末页</a>"
end if
response.write "    第"&ipage&"页 共"&rs.pageCount&"页"
response.write "</div>"

end if
end sub
%>