asp分页问题:点击下一页显示空白?

tbraz 2010-10-04 01:30:36
我这里有一个图片分页的问题,但点击下一页的时候显示不了,数据库有内容的,就是读不出来,请高手帮我解决一下,谢谢了。

<!首页:jingcai.asp-->
<!--#include file="conn.asp"-->
<!--#include file="inc.asp"-->
<%call head()%>
<link rel="stylesheet" href="3.css" type="text/css">
<title><%=netName%>---<%=lanmu3%></title>
<BASE onmouseover="window.status='<%=netName%>---<%=lanmu3%>';return true">
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="760" height="540">
<tr>
<td class=hang width="760" colspan="2" height="7">
<table border="0" width="758">
<tr>
<td class=hang width="187">
<marquee behavior="alternate" scrollamount="2" direction="right">
<%
Response.Write "<SCRIPT language=JavaScript> " & vbCrLf
Response.Write "today=new Date();function initArray(){this.length=initArray.arguments.length " & vbCrLf
Response.Write "for(var i=0;i<this.length;i++) " & vbCrLf
Response.Write "this[i]=initArray.arguments[i]}var d=new initArray( " & vbCrLf
Response.Write " ""星期日"", " & vbCrLf
Response.Write " ""星期一"", " & vbCrLf
Response.Write " ""星期二"", " & vbCrLf
Response.Write " ""星期三"", " & vbCrLf
Response.Write " ""星期四"", " & vbCrLf
Response.Write " ""星期五"", " & vbCrLf
Response.Write " ""星期六"");document.write( " & vbCrLf
Response.Write " today.getYear(),""年"", " & vbCrLf
Response.Write " today.getMonth()+1,""月"", " & vbCrLf
Response.Write " today.getDate(),""日"", " & vbCrLf
Response.Write " d[today.getDay()], " & vbCrLf
Response.Write " ""</font>""); " & vbCrLf
Response.Write " </SCRIPT> " & vbCrLf
%></marquee></td>
<td class=hang width="62"></td>
<form method="POST" action="jingcai.asp"><td class=hang width="487" ><p align="right">
——>搜索引擎</font> <input type="text" name="keyword" size="20" ><select name="where" size="1">
<option value="1" selected>标题</option>
<option value="2">内容</option>
</select>  <input type="submit" value="搜索" name="B1"></p>
</td> </form>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top" width="196" height="504"> 

</td>
<td valign="top" width="564" height="504">
<%
sql="SELECT * FROM jcsj order by d_id DESC"
if request("1") <> "" Then
sql="SELECT * FROM jcsj where jcsjleft = "&request("1")&" order by d_id DESC"
elseif request("keyword") <> "" Then
if Request("where") = "1" then
where="jcsjbt"
else
where="jcsjjj"
end if
keyword = Trim(Request("keyword"))
sql = "Select d_id,jcsjname,jcsjjj,jcsjleft,jcsjbt,date,count from jcsj where "&where&" like '%"& keyword &"%' order by d_id desc"
end if
Dim fileName,postion
fileName = Request.ServerVariables("script_name")
postion = InstrRev(fileName,"/")+1
fileName = Mid(fileName,postion)
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
const MaxPerPage=12
rs.PageSize=12
dim totalPut
dim CurrentPage
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
%>
<div align="left">
<table border="1" cellpadding="0" cellspacing="0" width="564" bordercolor="#f0f0f0">
<tr><td>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="25" background="img/b2.gif" height="35"></td>
<td width="531" background="img/b4.GIF">分类图片共<%=rs.recordcount%>幅</td>
</tr>
</table></td></tr>
<tr>
<td valign="top" width="556" height="484" >
<%
sub xianshi %>
<!-- 新闻展示表格 -->
<table width="556" height="600" border="0" align="center">
<tr>
<%do while not rs.eof and pages>0 %>
<td width="166" height="222" valign="top" align="left">
 <%
Response.Write "<td class=tl align=""center"" valign=""top"">" & vbCrLf
Response.Write "<table border='0' cellpadding='1' cellspacing='1'><tr><td align='center' width='120'><table border='0' cellspacing='0' cellpadding='0' align='center'><tr><td height='10'><img src='img/bg_0ltop.gif' width='10' height='10'></td><td height='10' background='img/bg_01.gif'></td><td height='10'><img src='img/bg_0rtop.gif' width='10' height='10'></td></tr><tr><td width=10 background=img/bg_03.gif> </td><td align='top' valign='middle' bgcolor='#FFFFFF'>" & vbCrLf
Response.Write "<p align=""center"">" & vbCrLf
Response.Write "<a href=""show.asp?d_id="&rs("d_id")&"&1=jcsj""><img src="&rs("jcsjname")&" width=""72"" height=""86"" border=""0""></a></td>" & vbCrLf
Response.Write "</td><td width='5' background='img/bg_04.gif'> </td></tr><tr><td height='10'><img src='img/bg_0lbottom.gif' width='10' height='10'></td><td height='10' background='img/bg_02.gif'></td><td height='10'><img src='img/bg_0rbottom.gif' width='10' height='10'></td></tr></table>" & vbCrLf
Response.Write "<p align=""center"" style=""text-decoration: blink"">"&rs("jcsjbt")&" " & vbCrLf
Response.Write "</td></tr></table>" & vbCrLf
%>
</td>
<%
'分栏主要由下面这个判断来执行的,本例是每行显示两栏
if (i mod 4) =0 then
%>
</tr><tr>
<%end if%>
<%
pages = pages - 1
rs.movenext
i=i+1
loop
Response.Write "</td></tr></table>" & vbCrLf
end sub
%>
<%
if rs.eof and rs.bof then
Response.Write "<center><font color=red>还没有添加图片。</font></center>"
else
pages=12
rs.pagesize=pages
if not isempty(Request.QueryString("page")) then
thispage=clng(Request.QueryString("page"))
else
thispage=1
end if
rscount=rs.recordcount
if thispage="" then thispage=1
if thispage<1 then thispage=1
if (thispage-1)*pages>rscount then
if (rscount mod pages)=0 then
thispage=rscount\pages
else
thispage=rscount\pages+1
end if
end if
if(rscount mod pages)=0 then
allpages=rscount\pages
else
allpages=rscount\pages+1
end if
rs.absolutepage=thispage
i=1
totalPut=rs.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
if currentPage=1 then
xianshi
%><tr>
<td valign="top" width="560" colspan="5" height="20">
<%showpage totalput,MaxPerPage,"jingcai.asp"%>
</td></tr>
<%
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
xianshi
%><tr>
<td valign="top" width="560" colspan="5" height="20">
<%showpage totalput,MaxPerPage,"jingcai.asp"%>
</td></tr>
<%
else
currentPage=1
xianshi
%><tr>
<td valign="top" width="560" colspan="5" height="20">
<%showpage totalput,MaxPerPage,"jingcai.asp"%>
</td></tr>
<%
end if
end if
end if
rs.close
%>
</td></tr></table></td></tr></table> </div></td> </tr> </table> </center> </div>
<%call copying()%>

<!config.asp-->
<%
Const NetName="测试" '站点名称
Const iejieshao="测试" '版权
Const email="" 'email
Const qq="" 'email
Const wangzhi="" '网址
Const logo="" 'logo
Const lanmu1="测试" '一级栏目1
Const lanmu2="测试" '一级栏目2
Const lanmu3="测试" '一级栏目3
Const lanmu4="测试" '一级栏目4
Const lanmu5="测试" '一级栏目5
Const lanmu6="测试" '一级栏目6
Const lanmu7="测试" '一级栏目7
Const lanmu8="测试" '一级栏目8
%>




另外数据库和图片都没问题,需要的可以联系我,谢谢!
...全文
148 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
tbraz 2010-10-06
  • 打赏
  • 举报
回复
谢谢大家了,经过一番研究后终于解决了,把“thispage=1”改为“thispage=CurrentPage”就行了。
Dogfish 2010-10-04
  • 打赏
  • 举报
回复
加个引号看看
response.write "<a href='" & filename & "?page=" & (CurrentPage+1) & "&keyword=" & keyword & "&ClassNo=" & ClassNo & "'>"
后浪 2010-10-04
  • 打赏
  • 举报
回复
你还是点击下一页的时候,打印一下传进来的值
response.write(pages)
response.end
再看其他值变化,一步步调试吧
tbraz 2010-10-04
  • 打赏
  • 举报
回复
<!conn.asp-->

<%
Dim Query_Badword,Form_Badword,i,Err_Message,Err_Web,name,jyjkw
Query_Badword="'∥and∥%∥%20∥ ∥ ∥union∥select∥update∥chr∥delete∥%20from∥;∥<∥>∥(∥)∥insert∥mid∥master.∥set∥chr(37)∥="
jyjkw="'∥and∥%∥%20∥ ∥ ∥union∥select∥update∥chr∥delete∥%20from∥;∥<∥>∥(∥)∥insert∥mid∥master.∥set∥chr(37)∥="
On Error Resume Next

filtrate=true
myday=1
mydata="jyjkw.mdb" '数据库文件
dim conn
dim rs

on error resume next

rs="DBQ="+server.mappath(mydata)+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};Pwd=netroom;"
set conn=server.createobject("ADODB.CONNECTION")
conn.open rs

If Err Then
err.Clear
Set Conn = Nothing
response.redirect "err.asp"
Response.End
End If

function showpage(totalnumber,maxperpage,filename)
dim n
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
response.write "<table cellspacing=1 width=""100%"" border=""0"" colspan=""4"" ><form method=Post action="""&filename&"?keyword="& keyword &"&ClassNo="& ClassNo &"""><tr><td align=right> "
if CurrentPage<2 then
response.write "共<b><font color=red>"&totalnumber&"</font></b>个 首页 上一页 "
else
response.write "共<b><font color=red>"&totalnumber&"</font></b>个 <a href="&filename&"?page=1&keyword="& keyword &"&ClassNo="& ClassNo &">首页</a> "
response.write "<a href="&filename&"?page="¤tPage-1&"&keyword="& keyword &"&ClassNo="& ClassNo &">上一页</a> "
end if

if n-currentpage<1 then
response.write "下一页 尾页"
else
response.write "<a href="&filename&"?page="&(CurrentPage+1)&"&keyword="& keyword &"&ClassNo="& ClassNo &">"
response.write "下一页</a> <a href="&filename&"?page="&n&"&keyword="& keyword &"&ClassNo="& ClassNo &">尾页</a>"
end if
response.write " 页次:<strong><font color=red>"¤tPage&"</font>/"&n&"</strong>页 "
response.write " <b>"&maxperpage&"</b>个/页 "
%>
转到:
<select name='page' size='1' style="font-size: 9pt" onChange='javascript:submit()'>
<%for i = 1 to n%>
<option value='<%=i%>' <%if CurrentPage=cint(i) then%> selected <%end if%>>第<%=i%>页</option>
<%next%>
</select> <%
response.write "</td></tr></FORM></table>"
end function
Function FlashNews(num,fontnum,PicWidthStr,PicHeightStr,BGcolor,txtheight,bm,wj)
Dim RsFilterObj,FlashStr,ImagesStr,TxtStr,LinkStr
FilterSql = "SELECT top "&num&" * FROM "&bm&" where img<>'' ORDER BY d_id DESC"
Set RsFilterObj = Conn.Execute(FilterSql)
If not RsFilterObj.Eof then
Dim Temp_Num
Temp_Num = 0
Do While Not RsFilterObj.Eof
Temp_Num = Temp_Num + 1
RsFilterObj.MoveNext
Loop
RsFilterObj.MoveFirst
If Temp_Num <=1 then
Set RsFilterObj = Nothing
FlashNews = "至少需要两条幻灯新闻才能正确显示幻灯效果"
Set RsFilterObj = Nothing
Exit Function
End If
do while Not RsFilterObj.Eof
if ImagesStr = "" then
ImagesStr = RsFilterObj("img")
TxtStr = gotTopic(RsFilterObj("d_title"),fontnum)

LinkStr = ""&wj&"?d_id="&RsFilterObj("d_id")
else
ImagesStr = ImagesStr &"|"& RsFilterObj("img")
TxtStr = TxtStr & "|" &gotTopic(RsFilterObj("d_title"),fontnum)
LinkStr = LinkStr & "|" & ""&wj&"?d_id="&RsFilterObj("d_id")
end if
RsFilterObj.MoveNext
loop
FlashStr="<script type=""text/javascript"">"& Chr(13)
FlashStr=FlashStr&"<!--"& Chr(13)
FlashStr=FlashStr&"var focus_width="&PicWidthStr& Chr(13)
FlashStr=FlashStr&"var focus_height="&PicHeightStr& Chr(13)
FlashStr=FlashStr&"var text_height="&txtheight& Chr(13)
FlashStr=FlashStr&"var swf_height = focus_height+text_height"& Chr(13)
FlashStr=FlashStr&"var pics='"&ImagesStr&"'"&Chr(13)
FlashStr=FlashStr&"var links='"&LinkStr &"'"&Chr(13)
FlashStr=FlashStr&"var texts='"&TxtStr&"'"&Chr(13)
FlashStr=FlashStr&"document.write('<object classid=""clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"" codebase=""http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"" width=""'+ focus_width +'"" height=""'+ swf_height +'"">');"&Chr(13)
FlashStr=FlashStr&"document.write('<param name=""allowScriptAccess"" value=""sameDomain""><param name=""movie"" value=""img/pic.swf""><param name=""quality"" value=""high""><param name=""bgcolor"" value="&BGcolor&">');"&Chr(13)
FlashStr=FlashStr&"document.write('<param name=""menu"" value=""false""><param name=wmode value=""opaque"">');"&Chr(13)
FlashStr=FlashStr&" document.write('<param name=""FlashVars"" value=""pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'"">');"&Chr(13)
FlashStr=FlashStr&"document.write('<embed src=""img/pic.swf"" wmode=""opaque"" FlashVars=""pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'"" menu=""false"" bgcolor="&BGcolor&" quality=""high"" width=""'+ focus_width +'"" height=""'+ swf_height +'"" allowScriptAccess=""sameDomain"" type=""application/x-shockwave-flash"" pluginspage=""http://www.macromedia.com/go/getflashplayer"" />');"&Chr(13)
FlashStr=FlashStr&"document.write('</object>');"&Chr(13)
FlashStr=FlashStr&"//-->"& Chr(13)
FlashStr=FlashStr&"</script>"
else
FlashStr="没有幻灯图片"
end if
RsFilterObj.Close
Set RsFilterObj = Nothing
FlashNews= FlashStr
End Function

function gotTopic(str,strlen)
if str="" then
gotTopic=""
exit function
end if
dim l,t,c, i
str=replace(replace(replace(replace(str," "," "),""",chr(34)),">",">"),"<","<")
l=len(str)
t=0
for i=1 to l
c=Abs(Asc(Mid(str,i,1)))
if c>255 then
t=t+2
else
t=t+1
end if
if t>=strlen then
gotTopic=left(str,i) & "..."
exit for
else
gotTopic=str
end if
next
gotTopic=replace(replace(replace(replace(gotTopic," "," "),chr(34),"""),">",">"),"<","<")
end function
function sqlcheck(Str)
if Instr(LCase(Str),"select ") > 0 or Instr(LCase(Str),"insert ") > 0 or Instr(LCase(Str),"delete ") > 0 or Instr(LCase(Str),"delete from ") > 0 or Instr(LCase(Str),"count(") > 0 or Instr(LCase(Str),"drop table") > 0 or Instr(LCase(Str),"update ") > 0 or Instr(LCase(Str),"truncate ") > 0 or Instr(LCase(Str),"asc(") > 0 or Instr(LCase(Str),"mid(") > 0 or Instr(LCase(Str),"char(") > 0 or Instr(LCase(Str),"xp_cmdshell") > 0 or Instr(LCase(Str),"exec master") > 0 or Instr(LCase(Str),"net localgroup administrators") > 0 or Instr(LCase(Str),"and ") > 0 or Instr(LCase(Str),"net user") > 0 or Instr(LCase(Str),"or ") > 0 then
Call Qcdn.Err_List("请不要在参数中包含非法字符尝试注入!",1)
Response.End
exit function
end if
Str=Replace(Str,"_","") '过滤SQL注入_
Str=Replace(Str,"*","") '过滤SQL注入*
Str=Replace(Str," ","") '过滤SQL注入空格
Str=Replace(Str,chr(34),"") '过滤SQL注入"
Str=Replace(Str,chr(39),"") '过滤SQL注入'
Str=Replace(Str,chr(91),"") '过滤SQL注入[
Str=Replace(Str,chr(93),"") '过滤SQL注入]
Str=Replace(Str,chr(37),"") '过滤SQL注入%
Str=Replace(Str,chr(58),"") '过滤SQL注入:
Str=Replace(Str,chr(59),"") '过滤SQL注入;
Str=Replace(Str,chr(43),"") '过滤SQL注入+
Str=Replace(Str,"{","") '过滤SQL注入{
Str=Replace(Str,"}","") '过滤SQL注入}
sqlcheck=Str '返回经过上面字符替换后的Str
end function
function strtext(str)
strtext=replace(str,chr(34),""")
end function
function strSql(str)
strSql=replace(str,"'","''")
end function
function flashSql(str)
flashSql=replace(str,"chr(124)","|")
end function
function intSql(Numeric)
if IsNumeric(Numeric) then
intSql=Numeric
else
intSql=0
end if
end function

function inthit(Numeric)
If(Numeric="") Then
inthit=1
else
if IsNumeric(Numeric) and Numeric>=1 then
inthit=Numeric
else
inthit=1
end if
End if
end function
Function validpersonal(username,password)
sql="select * from admin where name='"& strSql(username) &"' and pass ='"& strSql(password) &"'"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,3,2
If(rs.eof) Then
validpersonal=false
else
validpersonal=true
End if
End Function
function ChkPost()
dim server_v1,server_v2
chkpost=false
server_v1=Cstr(Request.ServerVariables("HTTP_REFERER"))
server_v2=Cstr(Request.ServerVariables("SERVER_NAME"))
if mid(server_v1,8,len(server_v2))<>server_v2 then
chkpost=false
else
chkpost=true
end if
end function

%>

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧