hi,
i want pagination using java script actually i get data from db that all row will hidden when i click next it will show next two row and hide the present row.but i have problem to go next and prevoius
i want pagination using java script actually i get data from db that all row will hidden when i click next it will show next two row and hide the present row.but i have problem to go next and prevoius
Code:
var count=0;
var rowcount=1;
function fnnext(totval)
{
if(rowcount<=totval)
{
if(count < totval)
{
document.getElementById(count).style.display="none";
count=count+1;
document.getElementById(count).style.display="none";
for(loop=count+1;loop<count+3;loop++)
{
document.getElementById(loop).style.display="block";
}
count++;
}
}
else
{
alert("End of the page")
}
rowcount=loop;
}
function fnprevious(totval)
{ alert(count)
if(rowcount > 2)
{
if(count > 2)
{
document.getElementById(count).style.display="none";
count=count+1;
document.getElementById(count).style.display="none";
for(loop=count-2;loop>0;loop--)
{
document.getElementById(loop).style.display="block";
}
count--;
}
}
else
{
alert("First page")
}
rowcount=loop;
alert(loop)
}
Comment