问题:
一个页面里有多个按钮用来提交表单,那这是form的属性action应该怎么写???
**解决方法:**其实很简单,我们只需要写一个JSP的函数来给action属性赋值就OK啦
<html>
<head>
<meta charset="utf-8">
<title>page</title>
<script>
function FormSubmit(){
document.form1.action="";//双引号添加需要跳转的页面就可以啦
document.form1.submit();
}
function FormSave(){
document.form1.action="";
document.form1.submit();
}
</script>
</head>
<body>
<form id="form1" method="post">
<p>用户名:<input type="text"></p>
<input type="button" id="submit" onclick="FormSubmit()">
<input type="button" id="save" onclick="FormSave()">
</form>
</body>
</html>```