Эти типы навигаций хороши, когда вы используете язык на стороне сервера, например PHP
или другой.
Основываясь на вашем вопросе, ниже ответ не является основным.
Note :
I believe you give each and every page with hard coded is lot better
Time taken for hardcodding ~ Time taken for `not mainstream`
Choose it wisely..
Ниже приведены несколько шагов, я объяснил, надеюсь, вы понимаете, это ясно
1. Initialize an array and store page names.
2. find the size of array
3. set current pagename in variable
4. find its location
5. If current location is greater than 0, then show prev button
6. If current location is lesser than total pages show next button
код начинается здесь
<script>
var pages = new Array("pageOne.html", "pageTwo.html", "PageThree.html", "PageFour.html", "PageFive.html", "PageSix.html");
var totalPages = pages.length;
var curPageName = "PageThree.html"; // Enter your page name here
var getCurPageLocation = pages.indexOf(curPageName);
console.log("Total Pages : " + totalPages);
console.log("Current Page Name : " + curPageName);
console.log("Position of Page in Array : " + getCurPageLocation);
/* To find prev and next page code starts from here */
if (getCurPageLocation > 0) {
var prevPageLocation = getCurPageLocation - 1;
var prevPageName = pages[prevPageLocation];
console.log("Prev Page Name : " + prevPageName);
}
if (getCurPageLocation < totalPages) {
var nextPageLocation = getCurPageLocation + 1;
var nextPageName = pages[nextPageLocation];
console.log("Next Page Name : " + nextPageName);
}
/* To find prev and next page code ends here */
</script>
И если вам нужно больше навигационных кнопок, как показано ниже
Предыдущая 1 2 3 4 Следующая
Пожалуйста, попробуйте сами ..
Возможный дубликат: http://stackoverflow.com/questions/16395963/previous-and-next-button-for-a-html-page – thebreiflabb