JavaScript: -> Directed submission with script implementation form

xiaoxiao2021-03-06  17

We know that each form has a background handler (such as a CGI program; ASP program, etc.) and corresponding to handle data submitted by forms. However, in some cases, we hope that the same form can be submitted to different background handles according to the user's choice. That is, the deposition of the form is submitted. For example, when writing a forum program, if we want to implement the user when sending a post, it will encounter the above problem when sending a submission function. That is, when the user clicks the submission button, we hope that the form is submitted to the "Submit" handler; and when the user clicks on the preview button, we hope that the form will be submitted to the Preview "handler. So how do you implement the above functions? The following code can solve this problem very well.

test form: