ASP初学者:困扰今天的代码看不懂/那个高手帮我解释下
Sub View_Words() dim gbcount,y,j,k
set rs = conn.execute("select COUNT(*) as gbcount From words")
gbcount=rs("gbcount")
rs.close
if gbcount/n = int(gbcount/n) then '计算出分页数
y=int(gbcount/n)
else
y=int(gbcount/n)+1
end if
page2= int(page/x)
if page/x>page2 then page2=page2+1
k=page2*x
if k>y then k=y
'打开留言字段'
if page=1 then
sql="select top "&n&" id,name,sex,head,web,email,title,words,date,reply,ip,come,view,qq From words Order By id Desc"
else
sql="select id,name,sex,head,web,email,title,words,date,reply,ip,come,view,qq From words Order By id Desc"
end if
if Page >100 then
rs.Open sql,Conn,1
else
Set Rs=Conn.Execute(sql)
end if
if Page>1 then RS.Move n*page-n
%>
<table width="700" border="0" cellspacing="1" cellpadding="4" align="center">
<tr>
<td width="667" height="20" align="right" class="unnamed1">有<%=gbcount %>条留言 <%=page %>/<%=y %>页 分页
<a href="?page=1"><<</a>
<% if page2>1 then %>
<a href="<%=indexfilename%>?page=<%=page2*x-x%>"><</a>
<% end if %>
<% For m =page2*x-(x-1) To k %>
[<a href="<%=indexfilename%>?page=<%=m%>"><%=m%></a>]
<%
Next
%>
<% if page2*x < y then %>
<a href="<%=indexfilename%>?page=<%=m%>">></a>
<% end if %>
<a href="?page=<%=y %>">>></a>
</td>
</tr>