Return to Snippet

Revision: 25939
at April 14, 2010 09:39 by linusx


Initial Code
currentPage = 2;
totalItems  = 304;
perPage     = 10;

if(curentPage == 1){
    if(totalItems > perPage){
        of = '1 - ' + perPage;
    }else{
        of = '1 - ' + totalItems;
    }
}else{
    nextMax = (parseInt(currentPage) * parseInt(perPage));
    x = (parseInt(nextMax) - parseInt(perPage)) + 1;
    if(nextMax >= totalItems){ nextMax = totalItems; }
    of = x + " - " + nextMax;
}

document.write "Results " + of + " of " + totalITems;

Initial URL


Initial Description
This will create the text 1 - 10

Initial Title
Results 1 - 10 of 304 list

Initial Tags
javascript

Initial Language
JavaScript