...

View Full Version : Non-php pagination script - where?



rideforever
12-20-2007, 05:47 AM
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 :)

vwphillips
12-20-2007, 02:05 PM
first attempt at this
I can modify to requirements on feedback


<!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>

rideforever
12-20-2007, 09:37 PM
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.

Arty Effem
12-21-2007, 12:29 AM
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

rideforever
12-21-2007, 08:05 AM
Cheers arty, I'll give it a look over. :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum