질문의 URI를 값으로 사용하여 각 질문에 숨겨진 필드를 만들면 onclick()에서 호출 한 JS 함수로 읽습니다. . 이벤트 등을 질문 번호, 예를 들어, 1.html, 2.html, 첫 번째 질문에 대한
으로 HTML 페이지의 이름을 삽입 : 탐색 버튼의
<input type='hidden' value='1' id='question'/>
,
<input type='button' value='Prev' onclick="getPrevious(document.getElementById('question');"/>
<input type='button' value='Next' onclick="getNext(document.getElementById('question');"/>
JS :
<script>
function getPrevious(question) {
if(question.value == 1) {
return;
} else {
window.location = (question.value - 1) + ".html";
}
}
function getNext(question) {
if(question.value == 40) {
return;
} else {
window.location = (question.value + 1) + ".html";
}
}
</script>