var prvPage =(page_offset==0)?1:page-1;
var nxtPage =(page_offset + page_count >= totalrecord)?page:page+1;
var TotalPage =Math.ceil(totalrecord/page_count);
TotalPage =(TotalPage==0)?1:TotalPage;
var pageHTML="";
pageBase="<font style='font-size:9pt'>Total Record:<font color='#ff0000'>"+totalrecord+"</font> Pages:"+TotalPage+" ";
if(TotalPage==1 || page==1)
pageHTML+="<font style='font-size:9pt' disabled>First</font> ";
else
pageHTML+="<a href='"+theLink+"&page=1'>First</a> ";
if(prvPage==page)
pageHTML+="<font style='font-family:Webdings;font-size:14px;' disabled>3</font> ";
else
pageHTML+="<a title='Prv' style='font-family:Webdings;font-size:14px;' href='"+theLink+"&page="+prvPage+"'>3</a> ";
if(TotalPage<=10)
{
var offset_left=1;
var offset_right=TotalPage;
}
else
{
if(page-5<1)
{
var offset_left=1;
var offset_right=10;
}
else
{
if(page+4>TotalPage)
{
var offset_left=TotalPage-9;
var offset_right=TotalPage;
}
else
{
var offset_left=page-5;
var offset_right=page+4;
}
}
}
for(var i=offset_left;i<=offset_right;i++)
{
if(page==i)
pageHTML+="<strong style='color:red'>"+i+"</strong> ";
else
pageHTML+="<a href='"+theLink+"&page="+i+"'>"+i+"</a> ";
}
if(nxtPage==page)
pageHTML+="<font style='font-family:Webdings;font-size:14px;' disabled>4</font> ";
else
pageHTML+="<a title='Next' style='font-family:Webdings;font-size:14px;' href='"+theLink+"&page="+nxtPage+"'>4</a> ";
if(TotalPage==page || TotalPage==1)
pageHTML+="<font style='font-size:9pt' disabled>End</font>";
else
pageHTML+="<a href='"+theLink+"&page="+TotalPage+"'>End</a>";
if(document.all("PageTop"))
{
document.all("PageTop").innerHTML=pageHTML;
}
document.write(pageBase+pageHTML); |