The form object encoding property holds the “enctype” attribute from the HTML <form> tag. The syntax for getting the encoding property is form.encoding
You can easily find out how many HTML elements are in the form by looking at the length property of the form object like so: from.length
The form object has a method property too that holds the submission type specified for the form in the <form> tag. The GET method sends form data to the server as URL variables. The POST method embeds the form data inside the HTTP request. You want to be careful about which method you use to send data in a form because the GET method exposes the data in the URL string. So, obviously, GET shouldn’t be used to send sensitive data to the server – use POST instead. Also, GET can result in the browser using cached data from an earlier request – which is probably not what you want, so pay attention to the HTTP method you choose.
The submit() method is sent to the form element to submit it. For example, if you name your form “inputform1”, then the following syntax will submit it: inputform1.submit().
So as you probably realized by now, you can submit a form programmatically inside a <script> tag or you can invoke a <script> using the “onsubmit” event. The “onsubmit” event is generated when the submit button in a form is clicked. The “onsubmit” event is supported by all major browsers, so it’s safe to use without worrying about what browser your user has installed. See the code snippet below for an example of the latter approach:
<html> <body> <form name=someform input type=”submit” onsubmit=”somefunction()”> </form> … <script> function somefunction() </html>