asp友情连接的代码谁帮我修改一下
代码如下,现在是一直排下去了,谁帮我修改一下,改成6个一行,自动换行啊,谢谢啦!--------------------------------------------<...
代码如下,现在是一直排下去了,谁帮我修改一下,改成6个一行,自动换行啊,谢谢啦!
--------------------------------------------
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="4"class="bluewb">
<%
set rs = server.CreateObject("adodb.recordset")
sql = "select top 12 linkimg,linkurl from links where linktype=3 order by linkid desc"
'response.Write sql
rs.open sql,conn,1,1
if not rs.eof then
%>
<tr>
<%
i=1
do while not rs.eof
linkurl=trim(rs("linkurl"))
linkimg=trim(rs("linkimg"))
if instr(linkimg,"/")>1 then linkimg="/"&linkimg
%>
<td class="lanwb" align="left"><a target=link href="http://<%=linkurl%>"> <img src=<%=linkimg%> width=50 height=18 border=1> </a> </td> <%
rs.movenext
i=i+1
loop
%>
</tr>
</table> <%else%>
<%end if%>
我自己已经搞定了:) 展开
--------------------------------------------
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="4"class="bluewb">
<%
set rs = server.CreateObject("adodb.recordset")
sql = "select top 12 linkimg,linkurl from links where linktype=3 order by linkid desc"
'response.Write sql
rs.open sql,conn,1,1
if not rs.eof then
%>
<tr>
<%
i=1
do while not rs.eof
linkurl=trim(rs("linkurl"))
linkimg=trim(rs("linkimg"))
if instr(linkimg,"/")>1 then linkimg="/"&linkimg
%>
<td class="lanwb" align="left"><a target=link href="http://<%=linkurl%>"> <img src=<%=linkimg%> width=50 height=18 border=1> </a> </td> <%
rs.movenext
i=i+1
loop
%>
</tr>
</table> <%else%>
<%end if%>
我自己已经搞定了:) 展开
展开全部
这个是我的,根据你自己的情况改一下吧
<table width="97%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FBFCF6">
<tr>
<td align="left" class="text"><%
fenlei=request("fenlei")
set rs=server.createobject("adodb.recordset")
sqltext="select * from honor where fenlei='"& fenlei &"'"
rs.open sqltext,conn,1,1
%>
您现在的位置:首页 >> <%=rs("fenlei")%></td>
</tr>
<tr>
<td>
<%
dim MaPerPage
MaPerPage=30
dim text,checkpage
text="0123456789"
Rs.PageSize=MaPerPage
for i=1 to len(request("page"))
checkpage=instr(1,text,mid(request("page"),i,1))
if checkpage=0 then
exit for
end if
next
If checkpage<>0 then
If NOT IsEmpty(request("page")) Then
CurrentPage=Cint(request("page"))
If CurrentPage < 1 Then CurrentPage = 1
If CurrentPage > Rs.PageCount Then CurrentPage = Rs.PageCount
Else
CurrentPage= 1
End If
If not Rs.eof Then Rs.AbsolutePage = CurrentPage end if
Else
CurrentPage=1
End if
call list
'显示帖子的子程序
Sub list()%>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" height="370" valign="top"><table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="100%"> </td>
</tr>
<tr>
<td class="a"><span style="font-weight: bold"><%=rs("fenlei")%></span></td>
</tr>
<tr>
<td height="10"></td>
</tr>
<tr>
<td height="22" class="textline"><table width="100%" height="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<%i=1 %>
<tr>
<td><table width="100%" border="0" cellspacing="1" cellpadding="0">
<%i=1 %>
<tr>
<% Do While Not rs.EOF%>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div align="center">
<table border="0" cellpadding="0" cellspacing="5" class="sibian">
<tbody>
<tr>
<td align="middle"><table align="center" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td align="middle" bgcolor="#ffffff" valign="center"><a href="photo_imgs.asp?id=<%=rs("id")%>"><img src="<%=rs("img")%>" alt="" width="110" border="0" /></a></td>
</tr>
</tbody>
</table></td>
</tr>
<tr>
<td align="center" class="text"><%=cutstr(rs("title"),8)%></td>
</tr>
</tbody>
</table>
</div></td>
</tr>
<tr>
<td height="10"></td>
</tr>
<tr>
<td class="text"><div align="center"></div></td>
</tr>
<tr>
<td height="10"></td>
</tr>
</table></td>
<% if i mod 5 =0 then%>
</tr>
<tr>
<%end if%>
<%
i=i+1
if i >= 26 then exit do
rs.MoveNext
loop
end sub
%>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td
height="1" colspan="3" background="img/naBialym.gif"><img height="1" src="img/1x1_pix.gif"
width="10" /></td>
</tr>
<tr>
<td
height="25" colspan="3" bgcolor="#EFEFEF" class="text">
<%
Response.write "<strong><font color='#000000'>-> 全部-</font>"
Response.write "共</font>" & "<font color=#FF0000>" & Cstr(Rs.RecordCount) & "</font>" & "<font color='#000000'>条信息</font></strong> "
Response.write "<strong><font color='#000000'>第</font>" & "<font color=#FF0000>" & Cstr(CurrentPage) & "</font>" & "<font color='#000000'>/" & Cstr(rs.pagecount) & "</font></strong> "
If currentpage > 1 Then
response.write "<strong><a href='photo.asp?fenlei="& fenlei &"&page="+cstr(1)+"'><font color='#000000'>首页</font></a><font color='#ffffff'> </font></strong>"
Response.write "<strong><a href='photo.asp?fenlei="& fenlei &"&page="+Cstr(currentpage-1)+"'><font color='#000000'>上一页</font></a><font color='#ffffff'> </font></strong>"
Else
Response.write "<strong><font color='#000000'>上一页 </font></strong>"
End if
If currentpage < Rs.PageCount Then
Response.write "<strong><a href='photo.asp?fenlei="& fenlei &"&page="+Cstr(currentPage+1)+"'><font color='#000000'>下一页</font></a><font color='#ffffff'> </font>"
Response.write "<a href='photo.asp?fenlei="& fenlei &"&page="+Cstr(Rs.PageCount)+"'><font color='#000000'>尾页</font></a></strong> "
Else
Response.write ""
Response.write "<strong><font color='#000000'>下一页</font></strong> "
End if
%> </td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<table width="97%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FBFCF6">
<tr>
<td align="left" class="text"><%
fenlei=request("fenlei")
set rs=server.createobject("adodb.recordset")
sqltext="select * from honor where fenlei='"& fenlei &"'"
rs.open sqltext,conn,1,1
%>
您现在的位置:首页 >> <%=rs("fenlei")%></td>
</tr>
<tr>
<td>
<%
dim MaPerPage
MaPerPage=30
dim text,checkpage
text="0123456789"
Rs.PageSize=MaPerPage
for i=1 to len(request("page"))
checkpage=instr(1,text,mid(request("page"),i,1))
if checkpage=0 then
exit for
end if
next
If checkpage<>0 then
If NOT IsEmpty(request("page")) Then
CurrentPage=Cint(request("page"))
If CurrentPage < 1 Then CurrentPage = 1
If CurrentPage > Rs.PageCount Then CurrentPage = Rs.PageCount
Else
CurrentPage= 1
End If
If not Rs.eof Then Rs.AbsolutePage = CurrentPage end if
Else
CurrentPage=1
End if
call list
'显示帖子的子程序
Sub list()%>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" height="370" valign="top"><table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="100%"> </td>
</tr>
<tr>
<td class="a"><span style="font-weight: bold"><%=rs("fenlei")%></span></td>
</tr>
<tr>
<td height="10"></td>
</tr>
<tr>
<td height="22" class="textline"><table width="100%" height="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<%i=1 %>
<tr>
<td><table width="100%" border="0" cellspacing="1" cellpadding="0">
<%i=1 %>
<tr>
<% Do While Not rs.EOF%>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div align="center">
<table border="0" cellpadding="0" cellspacing="5" class="sibian">
<tbody>
<tr>
<td align="middle"><table align="center" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td align="middle" bgcolor="#ffffff" valign="center"><a href="photo_imgs.asp?id=<%=rs("id")%>"><img src="<%=rs("img")%>" alt="" width="110" border="0" /></a></td>
</tr>
</tbody>
</table></td>
</tr>
<tr>
<td align="center" class="text"><%=cutstr(rs("title"),8)%></td>
</tr>
</tbody>
</table>
</div></td>
</tr>
<tr>
<td height="10"></td>
</tr>
<tr>
<td class="text"><div align="center"></div></td>
</tr>
<tr>
<td height="10"></td>
</tr>
</table></td>
<% if i mod 5 =0 then%>
</tr>
<tr>
<%end if%>
<%
i=i+1
if i >= 26 then exit do
rs.MoveNext
loop
end sub
%>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td
height="1" colspan="3" background="img/naBialym.gif"><img height="1" src="img/1x1_pix.gif"
width="10" /></td>
</tr>
<tr>
<td
height="25" colspan="3" bgcolor="#EFEFEF" class="text">
<%
Response.write "<strong><font color='#000000'>-> 全部-</font>"
Response.write "共</font>" & "<font color=#FF0000>" & Cstr(Rs.RecordCount) & "</font>" & "<font color='#000000'>条信息</font></strong> "
Response.write "<strong><font color='#000000'>第</font>" & "<font color=#FF0000>" & Cstr(CurrentPage) & "</font>" & "<font color='#000000'>/" & Cstr(rs.pagecount) & "</font></strong> "
If currentpage > 1 Then
response.write "<strong><a href='photo.asp?fenlei="& fenlei &"&page="+cstr(1)+"'><font color='#000000'>首页</font></a><font color='#ffffff'> </font></strong>"
Response.write "<strong><a href='photo.asp?fenlei="& fenlei &"&page="+Cstr(currentpage-1)+"'><font color='#000000'>上一页</font></a><font color='#ffffff'> </font></strong>"
Else
Response.write "<strong><font color='#000000'>上一页 </font></strong>"
End if
If currentpage < Rs.PageCount Then
Response.write "<strong><a href='photo.asp?fenlei="& fenlei &"&page="+Cstr(currentPage+1)+"'><font color='#000000'>下一页</font></a><font color='#ffffff'> </font>"
Response.write "<a href='photo.asp?fenlei="& fenlei &"&page="+Cstr(Rs.PageCount)+"'><font color='#000000'>尾页</font></a></strong> "
Else
Response.write ""
Response.write "<strong><font color='#000000'>下一页</font></strong> "
End if
%> </td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
展开全部
加个判断 if i mod 6=0,
如果i能被6整除就换行 response.write"</tr><tr>"。
<%
i=1
do while not rs.eof
linkurl=trim(rs("linkurl"))
linkimg=trim(rs("linkimg"))
if instr(linkimg,"/")>1 then linkimg="/"&linkimg
%>
<td class="lanwb" align="left"><a target=link href="http://<%=linkurl%>"> <img src=<%=linkimg%> width=50 height=18 border=1> </a> </td> <%
rs.movenext
i=i+1
loop
%>
上面这一段改为
<%
i=0
do while not rs.eof
linkurl=trim(rs("linkurl"))
linkimg=trim(rs("linkimg"))
if instr(linkimg,"/")>1 then linkimg="/"&linkimg
%>
<td class="lanwb" align="left"><a target=link href="http://<%=linkurl%>"> <img src=<%=linkimg%> width=50 height=18 border=1> </a> </td>
<%
i=i+1
if i mod 6=0 then
response.write"</tr><tr>"
end if
rs.movenext
i=i+1
loop
%>
就可以了。
如果i能被6整除就换行 response.write"</tr><tr>"。
<%
i=1
do while not rs.eof
linkurl=trim(rs("linkurl"))
linkimg=trim(rs("linkimg"))
if instr(linkimg,"/")>1 then linkimg="/"&linkimg
%>
<td class="lanwb" align="left"><a target=link href="http://<%=linkurl%>"> <img src=<%=linkimg%> width=50 height=18 border=1> </a> </td> <%
rs.movenext
i=i+1
loop
%>
上面这一段改为
<%
i=0
do while not rs.eof
linkurl=trim(rs("linkurl"))
linkimg=trim(rs("linkimg"))
if instr(linkimg,"/")>1 then linkimg="/"&linkimg
%>
<td class="lanwb" align="left"><a target=link href="http://<%=linkurl%>"> <img src=<%=linkimg%> width=50 height=18 border=1> </a> </td>
<%
i=i+1
if i mod 6=0 then
response.write"</tr><tr>"
end if
rs.movenext
i=i+1
loop
%>
就可以了。
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询