我正在尝试与Google一样分页,我创建了分页,如果我运行它工作正常,但如果我使用cfdiv加载内容并使用ajaxlink转到下一条记录,但它正在抛出每次都有一个错误,我正在检查是否有更好的jquery类型解决方案
如果你问我没有尝试过,我曾尝试过,之后我会问
这是我的cfdiv代码
<cfdiv id="section_scripts" bind="url:section_scripts.cfm" bindonload="true" OnBindError="handleGError"/>
上面的行有一个文件,其中包含为分页编写的代码,它显示第一个和下一个我点击,它会抛出错误
section_scripts.cfm文件的分页代码
<cfset CurrentPage=GetFileFromPath(GetTemplatePath())>
<cfparam name="PageNum_search" default="1">
<cfparam name="MaxRows_search" default="0">
<cfparam name="StartRow_search" default="0">
<cfparam name="EndRow_search" default="0">
<cfparam name="TotalPages_search" default="0">
<cfparam name="QueryString_search" default="">
<cfparam name="tempPos" default="">
<cfparam name="minimo" default="1">
<!--- setup page 1 --->
<cfset minimum = 1>
<!--- length of google bar --->
<cfset shownumbers = 5>
<!--- max rows per page --->
<cfset MaxRows_search=3>
<cfoutput>
<cfinvoke component="#application.cfcpath#.portfolio" method="getWebsites" id_external="1" returnvariable="search"/>
<!--- modify paging recordsets behavior of dreamweaver --->
<cfif search.recordcount>
<cfset StartRow_search=Min((PageNum_search-1)*MaxRows_search+1,Max(search.RecordCount,1))>
<cfset EndRow_search=Min(StartRow_search+MaxRows_search-1,search.RecordCount)>
<cfset TotalPages_search=Ceiling(search.RecordCount/MaxRows_search)>
<cfset QueryString_search=Iif(CGI.QUERY_STRING NEQ "",DE("&"&XMLFormat(CGI.QUERY_STRING)),DE(""))>
<cfset tempPos=ListContainsNoCase(QueryString_search,"PageNum_search=","&")>
<cfif tempPos NEQ 0>
<cfset QueryString_search=ListDeleteAt(QueryString_search,tempPos,"&")>
</cfif>
<cfif search.recordcount gt MaxRows_search>
<div class="pagenum">
<!—setup the numbers that we need to google bar -->
<cfif PageNum_search gte Ceiling(shownumbers/2)>
<cfif (shownumbers mod 2) neq 0>
<cfset minimum = PageNum_search - int(shownumbers/2)-1>
<cfelse>
<cfset minimum = PageNum_search - int(shownumbers/2)>
</cfif>
</cfif>
<cfif minimum eq 0>
<cfset minimum = 1>
</cfif>
<!--- setup the first page or page no. 1 --->
<cfif PageNum_search gt 1>
<a href="#ajaxLink('#CurrentPage#?PageNum_search=1#QueryString_search#')#"<cfif minimum eq PageNum_search>style="font-weight:bold; color:##339966"</cfif>>First Page</a> ||
<cfif minimum gte 2>
...
</cfif>
</cfif>
<cfloop index="limit" from="1" to="#shownumbers#">
<cfif TotalPages_search gte minimum >
<a href="#ajaxlink('#CurrentPage#?PageNum_search=#minimum##QueryString_search#')#" <cfif minimum eq PageNum_search>style="font-weight:bold; color:##FF9900"</cfif>>#minimum#</a>
</cfif>
<cfif minimum lt TotalPages_search>
<cfif limit eq shownumbers>
...
<cfelse>
,
</cfif>
</cfif>
<cfif minimum gt TotalPages_search>
<cfbreak>
</cfif>
<cfset minimum = minimum + 1>
</cfloop>
<!--- setup the last page --->
<cfif PageNum_search lt TotalPages_search>
|| <a href="#ajaxlink('#CurrentPage#?PageNum_search=#TotalPages_search##QueryString_search#')#" <cfif minimum eq PageNum_search>style="font-weight:bold; color:##339966"</cfif>>Last Page</a>
</cfif>
</div>
</cfif>
<table style="border:none;" align="center" width="100%" cellpadding="0" cellspacing="0" border="0" class="roundedBox">
<cfloop query="search" startRow="#StartRow_search#" endrow="#StartRow_search + (MaxRows_search - 1)#">
<cfif search.currentrow mod 2 eq 0>
<cfset color ="##EEEEEE">
<cfelse>
<cfset color ="##FFFFFF">
</cfif>
<tr bgcolor="#color#">
<td width="35%"><div class="cmsms_media_box" style="width:90% !important;margin:5px !important;padding:5px !important;border:1px dotted ##EAEAEA;">
<figure>
<a title="" rel="prettyPhoto" class="preloader" href="portfolio/big_#pic#" style="background-image: none;"> <img src="portfolio/small_#pic#" alt="" class="fullwidth" style="opacity: 1;"> </a>
</figure>
</div></td>
<td width="65%"> </td>
</tr>
</cfloop>
</table>
</cfif>
</cfoutput>
我收到错误
The web site you are accessing has experienced an unexpected error.
Please contact the website administrator.
The following information is meant for the website developer for debugging purposes.
Error Occurred While Processing Request
There was an error while validation.
For more details check logs.
The error occurred in C:/inetpub/wwwroot/Beauty/section_scripts.cfm: line 43
41 : <!--- setup the first page or page no. 1 --->
42 : <cfif PageNum_search gt 1>
43 : <a href="#ajaxLink('#CurrentPage#?PageNum_search=1#QueryString_search#')#"<cfif minimum eq PageNum_search>style="font-weight:bold; color:##339966"</cfif>>First Page</a> ||
44 : <cfif minimum gte 2>
45 : ...
谢谢
答案 0 :(得分:0)
错误告诉你出了什么问题。
The error occurred in C:/inetpub/wwwroot/Beauty/section_scripts.cfm: line 43
41 : <!--- setup the first page or page no. 1 --->
42 : <cfif PageNum_search gt 1>
43 : <a href="#ajaxLink('#CurrentPage#?PageNum_search=1#QueryString_search#')#"<cfif minimum eq PageNum_search>style="font-weight:bold; color:##339966"</cfif>>First Page</a> ||
44 : <cfif minimum gte 2>
45 : ...
在第43行,您错误地嵌套了哈希标记#
。你有这个是不允许的(你不能在哈希标签中有哈希标签):
<a href="#ajaxLink('#CurrentPage#?PageNum_search=1#QueryString_search#')#" ...
我假设您想要这样的东西(我删除了围绕整个ajaxLink语句的哈希标记):
<a href="ajaxLink('#CurrentPage#?PageNum_search=1#QueryString_search#')" ...
进一步评论后更新
根据您的下一个错误,我必须假设ajaxLink
不是文件而是JavaScript函数。因此,您需要相应地更改href
:
<a href="javascript:ajaxLink('#CurrentPage#?PageNum_search=1#QueryString_search#')" ...
或许你只想用URL参数直接链接到section.cfm
文件,在这种情况下你根本不需要ajaxLink()
。像这样:
<a href="#CurrentPage#?PageNum_search=1#QueryString_search#" ...
我不知道你对ajaxLink()
的意图是什么。