ASP竖排改横排
相关代码如下。数量可以控制。但是总是竖排。也不知道在哪里修改。请达人帮帮忙<%dimpage,pagesize,j,bg1page=request("page")page...
相关代码如下。数量可以控制。但是总是竖排。也不知道在哪里修改。请达人帮帮忙
<%
dim page,pagesize,j,bg1
page=request("page")
pagesize = 3
j=0
set rs=Server.CreateObject("ADODB.RecordSet")
sql="select id,topic,time1,price,pic from GameList order by"
if desc="price" then
sql=sql&" price"
elseif desc="price2" then
sql=sql&" price desc"
else
sql=sql&" xu asc"
end if
rs.Open sql,conn,1,1
rs.PageSize = PageSize
totalrecord=rs.recordcount
pgnum=rs.Pagecount
if page="" or clng(page)<1 then page=1
if clng(page) > pgnum then page=pgnum
if pgnum>0 then rs.AbsolutePage=page
do while not rs.eof
j=j+1
%>
<a href='../game/Detail<%=rs("id")%>.htm' > </a>
<table width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#d7d7d7" class="STYLE1">
<tr>
<td align="center" valign="middle" class="t1" bgcolor="#FFFFFF"><a href='../game/Detail<%=rs("id")%>.htm' > <img src='<%=rs("pic")%>' width="190" height="150" border="0" alt=""/> </a></td>
</tr>
<tr height="50">
<td bgcolor="#FFFFFF" align="center" style="font-size:14px;"><strong><a class='l4' href='Detail<%=rs("id")%>.htm'><%=rs("topic")%></a></strong><br />
<img src="/templates/Default/Images/m_wtxs01.gif" width="18" height="11" /> <span class="t10" style="color:#900; font-size:12px;">价格 </span><span class="nprice" style="color:#900; font-size:12px;"><%=rs("price")%></span> <span class="t6" style="color:#900; font-size:12px;">元</span></td>
</tr>
</table>
<a href="../game/Detail<%=rs("id")%>.htm"></a>
<%
if j mod 3 = 0 then
%>
<%
end if
if j>=PageSize then exit do
rs.movenext
loop
rs.close
set rs=nothing
%> 展开
<%
dim page,pagesize,j,bg1
page=request("page")
pagesize = 3
j=0
set rs=Server.CreateObject("ADODB.RecordSet")
sql="select id,topic,time1,price,pic from GameList order by"
if desc="price" then
sql=sql&" price"
elseif desc="price2" then
sql=sql&" price desc"
else
sql=sql&" xu asc"
end if
rs.Open sql,conn,1,1
rs.PageSize = PageSize
totalrecord=rs.recordcount
pgnum=rs.Pagecount
if page="" or clng(page)<1 then page=1
if clng(page) > pgnum then page=pgnum
if pgnum>0 then rs.AbsolutePage=page
do while not rs.eof
j=j+1
%>
<a href='../game/Detail<%=rs("id")%>.htm' > </a>
<table width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#d7d7d7" class="STYLE1">
<tr>
<td align="center" valign="middle" class="t1" bgcolor="#FFFFFF"><a href='../game/Detail<%=rs("id")%>.htm' > <img src='<%=rs("pic")%>' width="190" height="150" border="0" alt=""/> </a></td>
</tr>
<tr height="50">
<td bgcolor="#FFFFFF" align="center" style="font-size:14px;"><strong><a class='l4' href='Detail<%=rs("id")%>.htm'><%=rs("topic")%></a></strong><br />
<img src="/templates/Default/Images/m_wtxs01.gif" width="18" height="11" /> <span class="t10" style="color:#900; font-size:12px;">价格 </span><span class="nprice" style="color:#900; font-size:12px;"><%=rs("price")%></span> <span class="t6" style="color:#900; font-size:12px;">元</span></td>
</tr>
</table>
<a href="../game/Detail<%=rs("id")%>.htm"></a>
<%
if j mod 3 = 0 then
%>
<%
end if
if j>=PageSize then exit do
rs.movenext
loop
rs.close
set rs=nothing
%> 展开
展开全部
改成这样~~ 你直接贴过去``
<table><tr>
<%
dim page,pagesize,j,bg1
page=request("page")
pagesize = 3
j=0
set rs=Server.CreateObject("ADODB.RecordSet")
sql="select id,topic,time1,price,pic from GameList order by"
if desc="price" then
sql=sql&" price"
elseif desc="price2" then
sql=sql&" price desc"
else
sql=sql&" xu asc"
end if
rs.Open sql,conn,1,1
rs.PageSize = PageSize
totalrecord=rs.recordcount
pgnum=rs.Pagecount
if page="" or clng(page)<1 then page=1
if clng(page) > pgnum then page=pgnum
if pgnum>0 then rs.AbsolutePage=page
do while not rs.eof
j=j+1
%>
<td>
<a href='../game/Detail<%=rs("id")%>.htm' > </a>
<table width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#d7d7d7" class="STYLE1">
<tr>
<td align="center" valign="middle" class="t1" bgcolor="#FFFFFF"><a href='../game/Detail<%=rs("id")%>.htm' > <img src='<%=rs("pic")%>' width="190" height="150" border="0" alt=""/> </a></td>
</tr>
<tr height="50">
<td bgcolor="#FFFFFF" align="center" style="font-size:14px;"><strong><a class='l4' href='Detail<%=rs("id")%>.htm'><%=rs("topic")%></a></strong><br />
<img src="/templates/Default/Images/m_wtxs01.gif" width="18" height="11" /> <span class="t10" style="color:#900; font-size:12px;">价格 </span><span class="nprice" style="color:#900; font-size:12px;"><%=rs("price")%></span> <span class="t6" style="color:#900; font-size:12px;">元</span></td>
</tr>
</table>
<a href="../game/Detail<%=rs("id")%>.htm"></a>
</td>
<%
if j mod 3 = 0 then
%>
<%
end if
if j>=PageSize then exit do
rs.movenext
loop
rs.close
set rs=nothing
%>
</tr></table>
呵呵~~这是手写的理论代码哈` 也没数据库没测试` 若是哪里有问题可以再问我~
<table><tr>
<%
dim page,pagesize,j,bg1
page=request("page")
pagesize = 3
j=0
set rs=Server.CreateObject("ADODB.RecordSet")
sql="select id,topic,time1,price,pic from GameList order by"
if desc="price" then
sql=sql&" price"
elseif desc="price2" then
sql=sql&" price desc"
else
sql=sql&" xu asc"
end if
rs.Open sql,conn,1,1
rs.PageSize = PageSize
totalrecord=rs.recordcount
pgnum=rs.Pagecount
if page="" or clng(page)<1 then page=1
if clng(page) > pgnum then page=pgnum
if pgnum>0 then rs.AbsolutePage=page
do while not rs.eof
j=j+1
%>
<td>
<a href='../game/Detail<%=rs("id")%>.htm' > </a>
<table width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#d7d7d7" class="STYLE1">
<tr>
<td align="center" valign="middle" class="t1" bgcolor="#FFFFFF"><a href='../game/Detail<%=rs("id")%>.htm' > <img src='<%=rs("pic")%>' width="190" height="150" border="0" alt=""/> </a></td>
</tr>
<tr height="50">
<td bgcolor="#FFFFFF" align="center" style="font-size:14px;"><strong><a class='l4' href='Detail<%=rs("id")%>.htm'><%=rs("topic")%></a></strong><br />
<img src="/templates/Default/Images/m_wtxs01.gif" width="18" height="11" /> <span class="t10" style="color:#900; font-size:12px;">价格 </span><span class="nprice" style="color:#900; font-size:12px;"><%=rs("price")%></span> <span class="t6" style="color:#900; font-size:12px;">元</span></td>
</tr>
</table>
<a href="../game/Detail<%=rs("id")%>.htm"></a>
</td>
<%
if j mod 3 = 0 then
%>
<%
end if
if j>=PageSize then exit do
rs.movenext
loop
rs.close
set rs=nothing
%>
</tr></table>
呵呵~~这是手写的理论代码哈` 也没数据库没测试` 若是哪里有问题可以再问我~
展开全部
你如果清楚<tr>与<td>的含义,改起来就简单了
。<tr>是表格的行,而<td>是表格的单元格,也就是列了。
所以,要改成横排,首先,设置一个变量,这个变量用来控制每行要显示的列就行了
代码如下:
<%
'指定一个变量来设置列
dim
mcol
mcol=5
'例如5列
%>
....
while
....
.....
<tr>
<%
for
t=1
to
mcol
'这里要判断一下是不是到了记录末!
if
tpmen.eof=true
then
%>
<td> </td>
<%
else
%>
<td>这里是要显示的东西</td>
<%
end
if
next
%>
</tr>
....
wend
....
。<tr>是表格的行,而<td>是表格的单元格,也就是列了。
所以,要改成横排,首先,设置一个变量,这个变量用来控制每行要显示的列就行了
代码如下:
<%
'指定一个变量来设置列
dim
mcol
mcol=5
'例如5列
%>
....
while
....
.....
<tr>
<%
for
t=1
to
mcol
'这里要判断一下是不是到了记录末!
if
tpmen.eof=true
then
%>
<td> </td>
<%
else
%>
<td>这里是要显示的东西</td>
<%
end
if
next
%>
</tr>
....
wend
....
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询