JavaScript » Objects » Reset

A Reset object (a 'Reset' button) is created with every instance of an HTML <INPUT> tag (with a 'type' value set as 'RESET') on a form. Clicking this button resets the values of all form elements back to their defaults. These objects are stored in the elements array of the parent form and accessed using either the name defined within the HTML tag or an integer (with '0' being the first element defined, in source order, in the specified form).

Properties

constructor

Syntax: Object.constructor

This specifies a function to create an object's property and is inherited by all objects from their prototype.

form

Syntax: object.form

This property returns a reference to the Reset object's parent form.

name

Syntax: object.name

This property sets or returns the value of the Reset object's name attribute.

prototype

Syntax: Object.prototype.name = value

This allows the addition of properties and methods to any object.

type

Syntax: object.type

Every element on a form has an associated type property. In the case of a Reset object, the value of this property is always "reset".

value

Syntax: object.value

This property sets or returns the Submit object's value attribute. This is the text that is actually displayed on the button face. If this is not defined within the HTML tag the string 'Reset' is used by default.

Methods

blur

Syntax: object.blur( )

This method removes the focus from the specified reset button.

click

Syntax: object.click( )

This method simulates a mouse-click on the reset button.

eval

Syntax: Object.eval(string)

The eval method is deprecated as a method of Object, but is still used as a high level function. It evaluates a string of JavaScript in the context of an object.

focus

Syntax: object.focus( )

This method gives focus to the specified reset button.

handleEvent

Syntax: object.handleEvent(event)

This method calls the handler for the specified event.

toSource

Syntax: Object.toSource()

The toSource method returns a literal representing the source code of an object. This can then be used to create a new object.

toString

Syntax: Object.toString()

The toString method returns a string representing a specified object.

unwatch

Syntax: Object.unwatch(property)

This method removes a watchpoint set for an object and property name with the watch method.

valueOf

Syntax: Object.valueOf()

This method returns a primitive value for a specified object.

watch

Syntax: Object.watch(property, handlerfunction)

This method adds a watchpoint to a property of the object.

See Also: