Results 1 to 4 of 4

Thread: How to Delete Numbers on AJAX Pagination

  1. #1
    Join Date
    Jun 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question How to Delete Numbers on AJAX Pagination

    1) Script Title:
    AJAX Pagination
    2) Script URL (on DD):
    http://dynamicdrive.com/dynamicindex...nate/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!

  2. #2
    Join Date
    Aug 2004
    Posts
    9,878
    Thanks
    3
    Thanked 962 Times in 951 Posts
    Blog Entries
    15

    Default

    Sure. Try finding the below 3 lines in the .js file, and add to them the parts in red:

    Code:
    			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'

  3. #3
    Join Date
    Jun 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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:
    PHP Code:
    paginateHTML+='<a href="#next" rel="'+(selectedpage+1)+'">Next >></a>\n' 
    I would like to change it so it would look like this:
    PHP Code:
    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!
    Last edited by kodaks; 07-07-2008 at 06:36 PM.

  4. #4
    Join Date
    Aug 2004
    Posts
    9,878
    Thanks
    3
    Thanked 962 Times in 951 Posts
    Blog Entries
    15

    Default

    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:

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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •