http://blog.csdn.net/w709854369/article/details/6261624
I do not know if we have encountered this situation, when we submit a form, it may be due to different parameters to be submitted to a different action address. Then we can use JS to achieve this function.
===============
Submit the same content to a different page
===============
[JavaScript]View Plaincopy
- <mce:script type="Text/javascript" ><!--
- function Insertstu () {
- document.getElementById (' MyForm '). Action = "Ctl.jsp?op=insert";
- document.getElementById ("MyForm"). Submit ();
- }
- function Deletestu () {
- document.getElementById (' MyForm '). Action = "Ctl.jsp?op=delete";
- document.getElementById ("MyForm"). Submit ();
- }
- function Modifystu () {
- document.getElementById (' MyForm '). Action = "Ctl.jsp?op=modify";
- document.getElementById ("MyForm"). Submit ();
- }
- function Selectstu () {
- document.getElementById (' MyForm '). Action = "Ctl.jsp?op=select";
- document.getElementById ("MyForm"). Submit ();
- }
- T;</mce:script>
<form id= "MyForm" action= "" method= "POST" >
<input type= "button" Name= "Qurray" value= "Query" onclick= "Selectstu ()"/>
<input type= "button" Name= "Updata" value= "Modify" onclick= "Modifystu ()"/>
<input type= "button" value= "Add" onclick= "Insertstu ()"/>
<input type= "button" Name= "del" value= "delete" onclick= "Deletestu ()"/>
</form>
==========================================================
You can also write the JS statement directly in the onclick of the input button:
<form name= "Form1" action= "" >
<input type= "button" value= "Action1" onclick= "form1.action= ' 1 '; Form1.submit ();" >
<input type= "button" value= "Action2" onclick= "form1.action= ' 2 '; Form1.submit ();" >
</form>
JS Control Form Form Action whereabouts