当前位置: 移动技术网 > IT编程>开发语言>Asp > asp循环行数输出函数

asp循环行数输出函数

2017年12月12日  | 移动技术网IT编程  | 我要评论
经过大鸟哥的指导已做全面的修改,本人能力有限只能做到下面这步了: asp/visual basic代码 复制代码 代码如下:<% &nb
经过大鸟哥的指导已做全面的修改,本人能力有限只能做到下面这步了:

asp/visual basic代码 
复制代码 代码如下:

<%         
const p=6 '每页2条         
set rs = server.createobject("adodb.recordset")         
sql = "select * from show order by id desc"        
rs.open sql,conn,1         

i=0        
do while not rs.eof         
%>  <td align="center" height="98">        
    <a href="show.asp?id=<%=rs("id")%>">        
    <img src="<%=rs("pic")%>" width="150" height="98" alt="<%=rs("name")%>" /></a>        
  </td>     
<%     
if (i+1) mod 3 =0 then    
 response.write "</tr>"    
 if i<(p-1) then response.write "<tr>"    
end if    
i=i+1     
if i>p then exit do     
rs.movenext     
loop    
if i mod 3 <>0 then      
 for m=3-(i mod 3) to 1 step -1     
  response.write"<td> </td>"    
 next    
 response.write"</tr>"    
end if      
if i = 3 then    
 response.write" <td> </td><td> </td><td> </td></tr>"    
end if     
rs.close     
set rs=nothing     
%>    



之前的代码未更改 

复制代码 代码如下:

<%     
const p=6 '每页2条     
set rs = server.createobject("adodb.recordset")     
sql = "select * from show order by id desc"    
rs.open sql,conn,1     

i=1    
do while not rs.eof     
%>  <td align="center" height="98">    
    <a href="show.asp?id=<%=rs("id")%>">    
    <img src="<%=rs("pic")%>" width="150" height="98" alt="<%=rs("name")%>" /></a>    
  </td>    
<%     
if i mod 3 = 0 then     
response.write("</tr><tr>")     
end if     
i=i+1     
if i>p then exit do     
rs.movenext     
loop     
rs.close     
set rs=nothing    
%> 

如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网