PDA

View Full Version : How to Delete Numbers on AJAX Pagination



kodaks
07-06-2008, 08:04 PM
1) Script Title:
AJAX Pagination
2) Script URL (on DD):
http://dynamicdrive.com/dynamicindex17/ajaxpaginate/index.htm
3) Describe problem:
I would like to only have a "Previous" and "Next" button when I use this script. I do not want the individual numbers for the pages to be shown (like 2,3,4,5 etc.). How would I go about doing this?

Thanks! :)

ddadmin
07-07-2008, 06:55 AM
Sure. Try finding the below 3 lines in the .js file, and add to them the parts in red:


paginateHTML+='<li><a href="#previous" rel="'+(selectedpage-1)+'">Previous</a></li>\n'
for (var i=0; i<this.pageinfo.page.length; i++){
paginateHTML+='<li style="display:none"><a href="#page'+(i+1)+'" rel="'+i+'">'+(i+1)+'</a></li>\n'

kodaks
07-07-2008, 03:44 PM
Thanks so much, I really appreciate it!

One more question, if I may:

I would like to change the text "Next >>" into an image button of sorts. Originally, the button code looks like this:

paginateHTML+='<a href="#next" rel="'+(selectedpage+1)+'">Next >></a>\n'
I would like to change it so it would look like this:

paginateHTML+='<a href="#next" rel="'+(selectedpage+1)+'"><img src="images/nextbutton.gif"></a>\n'

When I made that change by adding an image button, the image showed up fine on the pagination, but the "next" button is no longer clickable.

What am I doing wrong?

Sorry about these simple PHP/Javascript questions! I've just started learning about php and javascript, but I've still got a long way to go! ;)

Thanks again!

ddadmin
07-07-2008, 07:33 PM
Ah yes, the script by default expects the pagination links to be text links, not image links. To detect for both, add the line in red to the existing line below:


var targetobj=window.event? window.event.srcElement : e.target
targetobj=(targetobj.tagName=="IMG")? targetobj.parentNode : targetobj