Javascript submission forms are easy to use for a page with multiple submit buttons

  • 2020-03-29 23:49:22
  • OfStack

 
<pre class="javascript" name="code">function check(txt){ 
$j("form").submit(function(){ 
if($txt==" submit "){ 
this.action="doAddMessage.action?button= submit "; 
this.submit(); 
}else{ 
this.action="doAddMessage.action?button= save "; 
this.submit(); 
} 
}); 
}</pre><br> 
<input type="IMAGE" src="style/blue/images/button/send.png" name="button" value=" submit " onclick="check(this)"/><input type="IMAGE"src="style/blue/images/button/saveToDraftBox.png" name="button" value=" save " onclick="check(this)"/> 
<pre></pre> 
<p><br> 
 For example, : There are two picture button submissions in the page, we can bind them all at this time onclick Event, this time we use the jquery the form The form has an event called submit . </p> 
<p> As shown in the picture, because I used it in my project dwr, I put the jquery The transfer of control to dwr . jquery To specify   a $j, We get the form and we use it submit Events, by judgment value , so that multiple pages can be skipped. </p> 
<p> </p> 
<p> </p> 

Related articles: