This article describes the implementation method of JavaScript dynamically creating form forms and submitting them. Share it for your reference, as follows:
When the page layout is a bit complicated, you may need to create a form dynamically in the page. The JavaScript creation form demonstration is as follows:
// JavaScript builds a formfunction MakeForm() { // Create a form var form1 = ("form"); = "form1"; = "form1"; // Add to body (form1); // Create an input var input = ("input"); // Set the corresponding parameters = "text"; = "value1"; = "1234567"; // Insert the input box into form (input); // form submission method = "POST"; // form submit path = "/servlet/info"; // Perform a commit to the form (); // Delete the form (form1); }
After calling MakeForm, create a Form immediately, commit, and remove the Form.
I hope this article will be helpful to everyone's JavaScript programming.