Home  >  Article  >  Web Front-end  >  How to use js to submit a form to easily solve the problem of multiple submit buttons on a page_javascript skills

How to use js to submit a form to easily solve the problem of multiple submit buttons on a page_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:14:411190browse
Copy code The code is as follows:

 function check(txt){ <br>$j("form").submit(function(){ <br>if($txt=="submit"){ <br>this.action="doAddMessage.action?button =Submit"; <br>this.submit(); <br>}else{ <br>this.action="doAddMessage.action?button=Save"; <br>this.submit(); <br>} <br>}); <br>}



 



For example: there are two image button submissions on the page. At this time, we You can bind onclick events to them all. At this time, we use the jquery form to have an event called submit.


As shown in the picture, since dwr is used in my project, I transferred the control of jquery to dwr, and jquery reassigned a $j. We get the form and then use submit Events can jump to multiple pages by judging the value of value.




Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn