转载自: http://www.cnblogs.com/liuswi/p/3473379.html 1 方法一: 2 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 3 <html> 4 <head> 5 <title></title> 6 <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 7 </head> 8 9 <body> 10 11 <form action="" name="form1"> 12 <input type="button" value="查询1" type="submit" onclick="form1.action=‘action_1‘;form1.submit();"/> 13 <input type="button" value="查询2" type="submit" onclick="form1.action=‘action_2‘;form1.submit();" /> 14 </form> 15 16 或: 17 <Script Language="JavaScript"> 18 function modify() 19 { 20 document.form1.action="modify.jsp"; 21 document.form1.submit(); 22 } 23 24 function delete() 25 { 26 document.form1.action="delete.jsp"; 27 document.form1.submit(); 28 } 29 </Script> 30 31 <form name="form1" action=""> 32 <INPUT Type="Button" Name="Modify" Value="修改" onClick="modify()"> 33 <INPUT Type="Button" Name="Delete" Value="删除" onClick="delete()"> 34 </form> 35 这样可以实现将多个按钮发送到不同的网页中。 36 </body> 37 </html> 38 39 方法二: 40 提交form的时候,里面的action不能带参数,例: 41 <form action="test.do?args=888"> 42 <input type="button" value="submit"> 43 </form> 44 45 通过这个方法,test.do无法读取args,必须换成以下写法 46 <form action="test.do"> 47 <input type="hidden" name="args" value="888"> 48 <input type="button" value="submit"> 49 </form>
时间: 2024-10-07 02:00:32