标签:turn trim nan als false nbsp code ext 跳转
<div>
<input type="text" id="jumpPage"/>
<input type="button" value="GO" onclick="Jump();" />
Total Pages:<input type="text" id="totalPages" value="{{ pages }}" />
</div>
<script>
function Jump() {
var val = document.getElementById(‘jumpPage‘).value.trim()
var totalPages = document.getElementById(‘totalPages‘).value.trim()
if(isNaN(val) || Number(val)<1 || Number(val)>Number(totalPages)||!(val.search(/\D/)===-1)){
alert("Please input a right page number")
document.getElementById(‘jumpPage‘).value = null
return false
}else{
location.href = "/index/"+val
}
}
</script>
标签:turn trim nan als false nbsp code ext 跳转
原文地址:https://www.cnblogs.com/DotSDot/p/13069120.html