Margaret101
08-08-2006, 04:56 PM
I am writing a simple paging script which is really getting on my nerves at this stage because all the major work is done and I now have a minor problem
The way i am doing this paging is quering the database once and then showing and hiding the results (I know not always the most efficient way of doing things)
My next button works fine it displays the results in groups of three's but the previous didplays the present results and all other previous results..
Can anyone see what i am doing wrong i just want the previous three results to appear??
<SCRIPT>
var intPosition=0;
function ShowFirstThreeItems()
{
var i;
i=1;
for (i=1; i<=3; i++)
{
eval('ItemRow'+i+'.style.display="block"');
intPosition=i;
}
}
function showNext()
{
var i;
for (i=1; i<=intPosition; i++)
{
eval('ItemRow'+i+'.style.display="none"');
}
for (i=intPosition+1; i<=intPosition+3; i++)
{
eval('ItemRow'+i+'.style.display="block"');
}
intPosition=i-1
}
function showPrev()
{
var i;
for (i=intPosition; i>0; i--)
{
eval('ItemRow'+i+'.style.display="block"');
}
for (i=intPosition+1; i<=intPosition-1; i--)
{
eval('ItemRow'+i+'.style.display="none"');
}
intPosition=i-3
}
The way i am doing this paging is quering the database once and then showing and hiding the results (I know not always the most efficient way of doing things)
My next button works fine it displays the results in groups of three's but the previous didplays the present results and all other previous results..
Can anyone see what i am doing wrong i just want the previous three results to appear??
<SCRIPT>
var intPosition=0;
function ShowFirstThreeItems()
{
var i;
i=1;
for (i=1; i<=3; i++)
{
eval('ItemRow'+i+'.style.display="block"');
intPosition=i;
}
}
function showNext()
{
var i;
for (i=1; i<=intPosition; i++)
{
eval('ItemRow'+i+'.style.display="none"');
}
for (i=intPosition+1; i<=intPosition+3; i++)
{
eval('ItemRow'+i+'.style.display="block"');
}
intPosition=i-1
}
function showPrev()
{
var i;
for (i=intPosition; i>0; i--)
{
eval('ItemRow'+i+'.style.display="block"');
}
for (i=intPosition+1; i<=intPosition-1; i--)
{
eval('ItemRow'+i+'.style.display="none"');
}
intPosition=i-3
}