Implement simultaneous submission of multiple form (base method) collections

Source: Internet
Author: User
Tags case statement switch case

method One:<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01//en" "HTTP://WWW.W3.ORG/TR/HTML4/STRICT.DTD" >or:<script language= "JavaScript" >function Modify () {document.form1.action= "Modify.jsp";    Document.form1.submit (); } function Delete () {document.form1.action= "Delete.jsp";    Document.form1.submit (); }</script><form name= "Form1" action= "" > <input type= "button" Name= "Modify" value= "Modify" onclick= "Modify () "> <input type=" button "name=" delete "value=" remove "onclick=" Delete () "></form>This enables multiple buttons to be sent to different Web pages. </body>method Two: When the form is submitted, the action inside cannot take parameters, for example:<form action= "test.do?args=888" > <input type= "button" value= "Submit" ></form>in this way, test.do cannot read args and must be replaced by the following notation<form action= "Test.do" > <input type= "hidden" name= "args" value= "888" > <input type= "button" value= "SUBM It "></form>

Reference two: http://blog.csdn.net/elifefly/article/details/7032334

1 a form form, submit to several different pages2  3  4 in the management of the page often encountered this situation: Select all the list, and then do a number of operations (delete, transfer, etc.), so that each record to make a form more trouble, too much HTML code and complex operation. You will typically encounter a form submitted to a different processing page, such as a delete.asp or move.asp that performs a deletion. The internet to find the next information, most of the methods are through the javascipt to achieve the above functions, the code is as follows. 5 6<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">78<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>9<title> a form, multiple submit buttons, submit to multiple different pages </title>Ten One     A<script> - function Sm1 () { -document.getElementById ("form_78"). action= "1.asp";  thedocument.getElementById ("form_78"). Submit ();  - }     - function sm2 () { -document.getElementById ("form_78"). action= "2.asp";  +document.getElementById ("form_78"). Submit ();  - }     +</script> A<form action= "" method= "Post" name= "form_78" id= "form_78" > at<input name= "MyText" type= "text" id= "MyText"/> -<input name= "BT1" type= "button" id= "BT1" value= "submitted to 1.asp" onclick= "sm1 ()"/> -<input name= "BT2" type= "button" id= "BT2" value= "submitted to 2.asp" onclick= "sm2 ()"/> -</form> -</body> - in============================================================================= - use JS to submit it.  to<input type= ' button ' value= ' AA ' onclick= ' Dosubmit (' show ') '/> +<input type= ' button ' value= ' AA ' onclick= ' dosubmit (' js ') '/> -   the<script> * function Dosubmit (otype) { $Document.myform.action= ' 123.asp?otype= ' +Otype;Panax Notoginseng document.myform.submit (); - } the</script> +================================================================================== A js a form to submit to multiple pages of the method summary thebcw52 article source: Network hits: 71 Update Time: 2010-12-3 + method One: Use multiple button buttons to design a sub-procedure for each button's onclick event, by reading the value of the button to determine to whom to submit the data, the source code is as follows: -<script language= "JavaScript" > $ function tosubmit1 () $ {  -document.submitform1.action= "1.asp";  - document.submitform1.submit (); the }    - function Tosubmit2 ()Wuyi {  thedocument.submitform1.action= "2.asp";  - document.submitform1.submit (); Wu }  - function tosubmit3 () About {  $document.submitform1.action= "3.asp";  - document.submitform1.submit (); - }  -</script> A +<form name= "Submitform1" action= "method=" post "target=" _blank "> the<input type= "button" Name= "Submit1" value= "Submit to 1.asp" onclick= "tosubmit1 ()" > -<input type= "button" Name= "Submit2" value= "Submit to 2.asp" onclick= "Tosubmit2 ()" > $<input type= "button" Name= "Submit3" value= "Submit to 3.asp" onclick= "Tosubmit3 ()" > the</form> the method Two: Use multiple button buttons, define the process of the OnClick event of each button, do not need to determine the value of the button, and directly define the form form of the action value, the code is relatively simple, as follows: the<form name= "Submitform2" action= "method=" post "target=" _blank "> the<input name= "Submit1" value= "submitted to 1.asp" type= "button" onclick= "submitform2.action= ' 1.asp '; Submitform2.submit ();" > -<input name= "Submit2" value= "submitted to 1.asp" type= "button" onclick= "submitform2.action= ' 2.asp '; Submitform2.submit ();" > in<input name= "Submit3" value= "submitted to 1.asp" type= "button" onclick= "submitform2.action= ' 3.asp '; Submitform2.submit ();" > the</form> the method Three: Also use multiple button buttons, and the same for each button to design an OnClick event sub-process, the difference is to use the switch case statement to determine the value of button buttons, so that the corresponding processing, the code is as follows: About<form name= "submitform3" action= "method=" post "target=" _blank "> the<input type= "Submit" Name= "Submit1" value= "Submit to 1.asp" onclick= "dothis (This)" > the<input type= "Submit" Name= "Submit2" value= "Submit to 2.asp" onclick= "dothis (This)" > the<input type= "Submit" Name= "Submit3" value= "Submit to 3.asp" onclick= "dothis (This)" > +</form> -<script language= "JavaScript" > the function dothis (obj)Bayi { the Switch(Obj.value) the { -  Case"Submit to 1.asp": -document.submitform3.action= "1.asp"; the  Break; the  Case"Submit to 2.asp": thedocument.submitform3.action= "2.asp"; the  Break; -  Case"Submit to 3.asp": thedocument.submitform3.action= "3.asp"; the  Break; the }94 } the</script> the  

1<script language= "JavaScript" >2 //Click the Submit button to trigger the following function3 function Submitit () {4 //first Form5var tform1= document.getelementbyid ("Formid1"); 6 //a second form7var tform2= document.getelementbyid ("Formid2"); 8   9    Ten //submit a first form One Tform1.submit ();  A //Submit a second form - Tform2.submit ();  -       the    - }   -    -</script> +    -     +<!--the first form, the method is post, will trigger the background of the login.do corresponding servlet, submitted to _hiddenframe1, that is login.do returned results will be hidden in _hiddenframe1-- A<form name= "Form1" id= "Formid1" action= "login.do" method= "post" target= "_hiddenframe1" > at<input type= "text" name= "Tname" value= "Zhang San" > -<input type= "button" Name= "Tsub" value= "Submit" onclick= "Javascript:submitit ();" > -</form> -    -<!--the second form, the method is post, will trigger the background of the sms.do corresponding servlet, submitted to the _hiddenframe2, that is, Sms.do returned results will be hidden in _hiddenframe2. Which through style= " Display:none; " has been hidden. - -    in<form name= "From2" id= "Formid2" action= "sms.do" method= "post" style= "Display:none;" target= "_hiddenframe2" > -<input type= "text" name= "Tname" value= "Harry" > to</form> +    -    the<!--joined style= "Display:none;" Used to hide- *<iframe name= "_hiddenframe1" style= "Display:none;" ></iframe> $   Panax Notoginseng<iframe name= "_hiddenframe2" ></iframe>

The

Implementation submits multiple form (base method) collections at the same time (go)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.