JavaScript Reference :: Form

The easiest way to create an FileUpload object is to get the HTML element using either the document method getElementById or getElementsByTagName to get a reference to an HTML form tag. Of course, you may also use document.createElement("form"). Once you have the element, you can assign event handlers or modify the properties.

methods

void reset()
Resets all the form elements to their original values.
void submit()
Submits the form.
object toSource()
Returns a literal representing the source code of the object e.g "function Object() { [native code] }" or "function Car(manufactuer, model, productionyear) { this.make = manufactuer; this.model = model; this.year = productionyear; }".
string toString()
Returns a string representing the object i.e. "[object Object]".
void unwatch(property)
Removes a previously set watchpoint.
								
object valueOf()
Returns the primitive value of the object e.g. "function Object() { [native code] }".
void watch(property, handlingFunction)
Calls the handlingFunction when the property is changed.
								

properties

action
The value provided in the action attribute of the HTML tag. This is the URL for the processing action on the server.
constructor
The constructor method is the base method used to create an instance of the object.
elements
An array of all elements contained in the form.
encoding
The value provided in the encoding attribute of the HTML tag.
method
The value provided in the method attribute of the HTML tag. This is the HTTP verb used when the form is submitted (e. g. GET or POST).
prototype
Exposes the prototype for the method or property of the object.
target
The value provided in the target attribute of the HTML tag. This can be either an existing or a new window.

events

onblur
ondblclick
onfocus
onkeydown
onkeypress
onkeyup
onmousedown
onmouseout
onmouseover
onmouseup
onreset
onresize
onsubmit