Chap 03 Forms and Event Handling
Chap 03 Forms and Event Handling
CHAPTER 03
Description
The HTML <form> tag is used for creating a form for user input. A form can
contain textfields, checkboxes, radio-buttons and more. Forms are used to pass
user-data to a specified URL.
Attribute Value Description
accept MIME_typ Specifies a comma-separated list of content types that the
e server accepts.
accept- charset list Specifies a list of character encodings that the server
charset accepts. The default value is "unknown".
action URL Specifies a URI/URL of the back-end script that will process
the form
autocomplet On/off Specifies whether form should have autocomplete on or off
e
enctype mimetypes The mime type used to encode the content of the form.
method get •Specifies the HTTP method to use when the form is
post submitted. Possible values −get (the form data is appended
to the URL when submitted)
•post (the form data is not appended to the URL)
name form name Defines a unique name for the form.
novalidate no validate Specifies that the form should not be validated when
submitted.
target Target to open the given URL.
_blank _blank − the target URL will open in a new window.
_self _self − the target URL will open in the same frame as it
was clicked.
_parent _parent − the target URL will open in the parent
_top frameset.
_top − the target URL will open in the full body of the
window.
HTML FORM CONTROLS
There are different types of form controls that you can use to collect
data using HTML form −
There are following three events which are generated by keyboard. These events are not
valid in base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, style, and
title elements.
var x = document.getElementById("myForm");
var x = document.createElement("FORM");
The HTML DOM Element Object