var getPageData = function (last_page, current_page) { var numberLinks = []; var i = 0; for (i; i < last_page; i++) { var num = i + 1; var f = Math.abs(current_page - num); if (f < 4) { // 左3页,右3页 numberLinks.push(num); } } return numberLinks; };