Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Feb 2006
    Posts
    24
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Lightbulb Non-php pagination script - where?

    Hi all,

    I'm hunting around for a decent javascript pagination scirpt that can break a long article up into variables and offer pagination options on a standard html page.

    I've seen various ajax options that receive feeds from external pages but this isn't suitable (hotscripts, dynamic drive etc...). Neither do I wish to give the pages I wish to paginate a php extension as that would sit out of the flow of my site.

    Can anyone recommend a simple to use pagination script based in javascript and compatible on a html page?

    Thanks
    Stephen

  • #2
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,505
    Thanks
    3
    Thanked 501 Times in 488 Posts
    first attempt at this
    I can modify to requirements on feedback

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
      <title></title>
    <style type="text/css">
    /*<![CDATA[*/
    .tab {
     width:80px;height:20px;left:4px;top:-22px;background-Color:#FFFFCC;text-Align:center;border:solid black 1px;cursor:pointer;
    }
    
    /*]]>*/
    </style><script language="JavaScript" type="text/javascript">
    /*<![CDATA[*/
    // Pagination (20-December-2007) DRAFT
    // by Vic Phillips http://www.vicsjavascripts.org.uk
    
    
    function zxcPagination(zxcid,zxctabcls){
     var zxcp=document.getElementById(zxcid);
     var zxcclds=zxcp.childNodes;
     var zxcpages=[[]];
     var zxcpcnt=0;
     for (var zxc0=0;zxc0<zxcclds.length;zxc0++){
      if (zxcclds[zxc0].className&&zxcclds[zxc0].className=='pagebreak'){ zxcpcnt++;  zxcpages[zxcpcnt]=[]; }
      zxcpages[zxcpcnt].push(zxcclds[zxc0]);
     }
     while (zxcp.childNodes.length>0) zxcp.removeChild(zxcp.childNodes[0]);
     for (var zxc1=0;zxc1<zxcpages.length;zxc1++){
      var zxcpage=zxcES('DIV',{position:'relative',display:(zxc1>0)?'none':'',left:'0px',top:'0px'},zxcp);
      var zxctab=zxcES('DIV',{position:'absolute'},zxcp,'Page '+(zxc1+1));
      zxctab.className=zxctabcls;
      zxcES(zxctab,{left:zxctab.offsetLeft+zxctab.offsetWidth*zxc1+zxctab.offsetLeft*zxc1+'px'});
      zxctab.p=zxcp;
      zxctab.page=zxcpage;
      zxctab.onclick=function(){ zxcPage(this); }
      for (var zxc1a=0;zxc1a<zxcpages[zxc1].length;zxc1a++) zxcpage.appendChild(zxcpages[zxc1][zxc1a]);
      if (zxc1==0) zxcp.lst=zxcpage;
     }
    }
    
    function zxcPage(zxcpage){
     zxcpage.p.lst.style.display='none';
     zxcpage.p.lst=zxcpage.page
     zxcpage.page.style.display='';
    }
    
    
    function zxcES(zxcele,zxcstyle,zxcp,zxctxt){
     if (typeof(zxcele)=='string'){ zxcele=document.createElement(zxcele); }
     for (key in zxcstyle){ zxcele.style[key]=zxcstyle[key]; }
     if (zxcp){ zxcp.appendChild(zxcele); }
     if (zxctxt){ zxcele.appendChild(document.createTextNode(zxctxt)); }
     return zxcele;
    }
    
    /*]]>*/
    </script></head>
    
    <body onload="zxcPagination('tst','tab');">
    <br />
    <br />
    <div id="tst" style="position:relative;width:200px;height:200px;border:solid black 1px;" >
    I'm hunting around for a decent javascript pagination scirpt that can break a long article up into variables and offer pagination options on a standard html page.
    <span class="pagebreak" ></span>
    I've seen various ajax options that receive feeds from external pages but this isn't suitable (hotscripts, dynamic drive etc...). Neither do I wish to give the pages I wish to paginate a php extension as that would sit out of the flow of my site.
    </div>
    
    </body>
    
    </html>
    Vic

    God Loves You and will never love you less.

    http://www.vicsjavascripts.org/Home.htm

    If my post has been useful please donate to http://www.operationsmile.org.uk/

  • #3
    New Coder
    Join Date
    Feb 2006
    Posts
    24
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Thumbs up

    Hi Vic,

    Huge thanks for that. I think I found the script I'm after at: http://www.peachpit.com/articles/article.aspx?p=464632 which includes page numbers, next and previous - and even very basic print and email functionality.

    The bulk of the code (minus your html and css of course) is online at the below code-bin, if you're interested.

    http://code-bin.homedns.org/74

    Took a long time to find. Along with your script, there's also one by Dynamic Drive called the Virtual Pagination script, that offers similar functionality.

    Cheers.

  • #4
    Banned
    Join Date
    May 2006
    Location
    England
    Posts
    664
    Thanks
    0
    Thanked 84 Times in 84 Posts
    Quote Originally Posted by rideforever View Post
    Hi all,

    I'm hunting around for a decent javascript pagination scirpt that can break a long article up into variables and offer pagination options on a standard html page.

    I've seen various ajax options that receive feeds from external pages but this isn't suitable (hotscripts, dynamic drive etc...). Neither do I wish to give the pages I wish to paginate a php extension as that would sit out of the flow of my site.

    Can anyone recommend a simple to use pagination script based in javascript and compatible on a html page?
    See if this one does what you need: http://scripterlative.com/?pagin1

  • #5
    New Coder
    Join Date
    Feb 2006
    Posts
    24
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Thanks for that

    Cheers arty, I'll give it a look over.


  •  

    Posting Permissions

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