document.form.command.value

问题:在一个JSP页面中需要多个提交按钮,每个按钮点击后需要把同一个form提交到不同的页面进行处理

解决:用JS。

<html>
<head>
<title>一个表单、多个提交按钮、提交到多个不同页面</title>
</head>

<script>
function sm1(){
   document.getElementByIdx("form1").action="1.jsp";
   document.getElementByIdx("form1").submit();
}
function sm2(){
   document.getElementByIdx("form1").action="2.jsp";
   document.getElementByIdx("form1").submit();
}
</script>

<body>
<form action="" method="post" id="form1">
 <input name="mytext" type="text" id="mytext" />
 <input name="bt1" type="button" id="bt1" value="提交到1.jsp" onclick="sm1()" />
 <input name="bt2" type="button" id="bt2" value="提交到2.jsp" onclick="sm2()" />
</form>
</body>
</html>

上一篇:elasticsearch_.net_client_nest2.x_到_5.x常用方法属性差异


下一篇:Beta版本使用说明