document.getElementById("in").submit();

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>输入页</title>
</head>
<body>
<form id="in" action="SortPage" method="post">
<input type="text" name="num" id="demo"/>
<input type="button" value="提交" onclick="check()"/>
<input type="button" value="注销" onclick="logout()"/>
</form>
<script type="text/javascript">
function logout(){
window.location.href = "Remove";
}

function check()
{
var x=document.getElementById("demo").value;
if(x==""||isNaN(x))
{
alert("只能输入数字!");
}
else
{
document.getElementById("in").submit(); //提交表单,页面跳 转,执行排序类,跳转到显示页面。
}
}
</script>
</body>
</html>



原文地址:https://www.cnblogs.com/cyy-13/p/5780206.html