ASP中怎么实现点击一个按钮就转到另一个处理页面进行相应处理?

<form name="form1" method="post" action="">
<label>
<input type="submit" name="Submit" value="确认订单">
</label>
<label>
<input type="submit" name="Submit2" value="撤销订单">
</label>
</form>
此页面有两个按钮,我想点击“确认订单”按钮就转到一个页面进行相应操作,点击“撤销订单”就转到另一个页面进行操作,应该怎么写代码实现?

跳转到另一页面进行相应的处理,常用的有二种方式。
1 地址栏传值。
<a href='b.asp?id=3&name=n'>a页面点击这里跳到b页面</a>
b页面根据传入的id和name参数进行处理。
2 post传值。
<form action="b.asp" method="post">
<input name='id' value='' >
<input name='name' value='' >
</form>

b页面根据传入的表单值进行处理。

除以上二种外,还可以使用cookie和session这二种方式。
但一般不建议使用,因为这二种方式多用于存储用户信息等简单的信息,特别是session如果大量的使用,可能会造成内存占用过多,给服务器增加压力。
温馨提示:答案为网友推荐,仅供参考
第1个回答  2013-07-04
可通过JS脚本控制表单的递交地址来实现,比如:
<input type="button" name="btnSubmit" value="确认定单" onclick="doSubmit()">
<input type="button" name="btnSubmit" value="撤消定单" onclick="doCancel()">
JS脚本如下:
<script language="javascript">
function doSubmit(){
var frm=document.form1;
frm.action="[确认定单的页面]";
}
function doCancel(){
var frm=document.form1;
frm.action="[撤消定单的页面]";
}
</script>
至于原始<form>中的action属性可以保留为空或一个默认的地址。
第2个回答  2013-07-04
按钮动作不一定是提交表单,如:
<input type="submit" name="button" id="button" value="提交" />
<input type="button" name="button2" id="button2" value="按钮"/>
前者的作用是提交表单,点击后提交到form的action属性指定的处理页面上
后者必须人为地指定动作,否则没有意义,因此可以加上:
onclick="window.location.href='xxx.htm'"
点击后转到xxx.htm本回答被网友采纳
第3个回答  推荐于2016-02-08
需要两个文件,
index.asp

<body>
<!--这里的 P.ASP 可以改成自已需要的页面,必须要和 index.asp 放在同一个目录-->
<form id="form1" name="form1" method="post" action="p.asp">
<label for="username">姓名:</label>
<input type="text" name="username" id="username" />
<input type="submit" name="button" id="button" value="提交" />
</form>
</body>
</html>

p.asp

<%

response.write request("username")

%>
第4个回答  2013-07-04
一般好像没有撤销订单的。
所以应该为:
<form name="form1" method="post" action="执行订单的页面.asp">
<label>
<input type="submit" name="Submit" value="确认订单">
</label>
</form>