网上找了一个例子。
<!--- Next x record function --->
<cffunction name="nextXpage" access="public" returntype="struct" hint="Next x page function" output="No">
<cfargument name="recordcount" required="Yes" default="0" type="numeric" hint="The total numbers of records / values">
<cfargument name="page" required="Yes" type="numeric" default="0" hint="The page number that you are currently on. (for example URL.page)">
<cfargument name="maxrows" required="No" type="numeric" default="10" hint="The maximum records / values to be displayed per page">
<!--- Define the return structure --->
<cfset var nextXpage = structNew()>
<!--- Calculate how much page are available according to the maxrows displayed --->
<cfset nextXpage.pagecount = CEILING(arguments.recordcount / arguments.maxrows)>
<!--- Set the maximum rows to be displayed --->
<cfset nextXpage.maxrows = arguments.maxrows>
<!--- Set the currentpage --->
<cfset nextXpage.currentpage = arguments.page>
<!--- Set the currentpage --->
<cfset nextXpage.recordcount = arguments.recordcount>
<!--- Set the startrow value --->
<cfif arguments.page eq 1>
<cfset nextXpage.startrow = 1>
<cfelse>
<cfset nextXpage.startrow = (arguments.page * arguments.maxrows) - (arguments.maxrows -1)>
</cfif>
<!--- Define the previous and next values. --->
<!--- Next values --->
<cfif arguments.page neq nextXpage.pagecount>
<cfset nextXpage.next = true>
<cfset nextXpage.nextpage = arguments.page + 1>
<cfelse>
<cfset nextXpage.next = false>
<cfset nextXpage.nextpage = 1>
</cfif>