View Full Version : Ajax Pagination script help!

09-18-2007, 02:48 PM
1) Script Title: Ajax Pagination script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxpaginate/index.htm

3) Describe problem: I have intergrated this script into my site (http://www.owlwebs.co.uk/sites.html) but for some reason i have lost the previous and next arrows from the navigation? I have trawled through the code (i am not fluent in most forms of code!) but i can find no reference to these arrows? I am aware this will prbably be something amazingly obvious but please help me!

Many thanks in advance


p.s. also the script wont open directly onto the first page either?! thanks again if you can help!

09-18-2007, 03:10 PM

if (this.pageinfo.page.length==1)
var paginateHTML="Page 1 of 1" //Pagination HTML to show when there's only 1 page (no pagination needed)
else{ //construct pagimation interface
var paginateHTML='<div class="pagination"><ul>\n'
paginateHTML+='<li><a href="#previous" rel="'+(selectedpage-1)+'"> </a></li>\n'
for (var i=0; i<this.pageinfo.page.length; i++){
paginateHTML+='<li><a href="#page'+(i+1)+'" rel="'+i+'">'+(i+1)+'</a></li>\n'
paginateHTML+='<li><a href="#next" rel="'+(selectedpage+1)+'">next </a></li>\n'[/icode]

change that to &laquo; and &raquo; respectively

09-18-2007, 04:25 PM
Cheers for that!! If you can also tell how to make it start on the first page instead of having to click on the number one it would be great!!

09-18-2007, 05:50 PM
when you link to that page add the number you wish to start on eg

<a href="/sites.html#page1>Link</a>


<a href="/sites.html#page2>Link</a>


<a href="/sites.html#page3>Link</a>

09-18-2007, 08:15 PM
Actually, the problem is because there's a error with the way you set up the script:

var mypages=new ajaxpageclass.bindpages(myajaxbook, "pcontent", ["paginate-top", "paginate-bottom"])

You need to remove the last parameter, since you don't have a corresponding "paginate-bottom" DIV defined on the page. In other words, change that to:

var mypages=new ajaxpageclass.bindpages(myajaxbook, "pcontent", ["paginate-top"])

09-18-2007, 08:25 PM
var mypages=new ajaxpageclass.bindpages(myajaxbook, "pcontent", ["paginate-top"])

wouldn't you get rid of the square brackets too? those are to say which parameters are optional

var mypages=new ajaxpageclass.bindpages(myajaxbook, "pcontent", "paginate-top")

09-18-2007, 08:39 PM
wouldn't you get rid of the square brackets too?

No, since the 3rd parameter expects an array, which the bracket is for.