回 帖 发 新 帖 刷新版面

主题:[讨论]请问哪里错了,分页的

我点页码后内容没变- -~~~这是我模仿课本的例子写的...唉,理解不了
test.asp:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn/conn.asp"-->
<!--#include file="conn/function.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<style type="text/css">
#l1 li a{
float:left;
}
ul li div{
float:right;
}
div{

}
</style>
<title>无标题文档</title>
</head>

<body>
<%
dim sql,rs,r
sql="select * from news order by date desc"
set rs=server.CreateObject("ADODB.recordset")
rs.open sql,db,1
if not rs.eof and not rs.bof then
dim page_size
dim page_no
dim page_total
page_size=5
if request("page_no")="" then
page_no=1
else
page_no=cint(request("page_no"))
end if
session("page_no")=page_no
rs.pagesize=page_size
page_total=rs.pagecount
rs.absolutepage=page_no
dim i,j
i=0
j=page_size
%>
<ul id="l1">
<%do while not rs.eof  and j>0
i=i+1
j=j-1
if rs("hit") >5 then
r="#FF0000"
else
r="#000000"
end if
%>
<li id="l2"> <a href="conn/hit.asp?news_id=<%=rs("news_id")%>"><font color=<%=r%>>[<%=rs("type")%>]<%=rs("title")%></font></a><div id="l3">123</div></li>

<%rs.movenext
loop
end if
%>
</ul>
<%
call select_page(page_no,page_total)
%>
</body>
</html>

----------------------------------------------------------------------------
function.asp:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<body>
<%private sub select_page(page_no,total_page)
    response.write"请选择页码:"
    dim i
    for i=1 to total_page
        if i=page_no then
            response.write i&"&nbsp"
            else
            response.Write "<a href ='test.asp?page_no"&i&"'>"&i&"</a>&nbsp"
            end if
            next
            end sub
%>
</body>
</html>

大侠们帮忙看看...哪里错了

回复列表 (共1个回复)

沙发

=.=~原来是
response.Write "<a href ='test.asp?page_no"&i&"'>"&i&"</a>&nbsp"
page_no那少了个=号..
能给自己加分吗- -

我来回复

您尚未登录,请登录后再回复。点此登录或注册