Javascript:跳转到指定页面

1 <div> 2 <input type="text"/> 3 <input type="button" value="GO" /> 4 Total Pages:<input type="text" value="{{ pages }}" /> 5 </div> 6 <script> 7 function Jump() { 8 var val = document.getElementById('jumpPage').value.trim() 9 var totalPages = document.getElementById('totalPages').value.trim() 10 if(isNaN(val) || Number(val)<1 || Number(val)>Number(totalPages)|| !(Number(val) %1 === 0)){ 11 alert("Please input a right page number") 12 document.getElementById('jumpPage').value = null 13 return false 14 }else{ 15 location.href = "/index/"+val 16 } 17 } 18 </script>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wpxsff.html