/ Published in: JavaScript
This will create the text 1 - 10
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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;