please dont rip this site

JavaScript: The Definitive Guide

Previous Chapter 21
JavaScript Reference
Next
 

Reset Element

Name

Reset Element---a button to reset a form's values

Availability

Navigator 2.0, Internet Explorer 3.0; enhanced in Navigator 3.0

Synopsis

form.name
form.elements[i]

Properties

form

A read-only reference to the Form object that contains the Reset element.

name

A read-only string, set by the HTML NAME attribute, that specifies the name of the Reset element. This is also the name that can be used to reference the Reset element as a property of its form.

type

A read-only string that specifies the type of this form element. For Reset elements, it has the value "reset". Available in Navigator 3.0 and later.

value

A read-only string, set by the HTML VALUE attribute, that specifies the text to appear in the button. If no VALUE is specified, then (in Navigator) the button will be labelled "Reset" by default.

Methods

blur()

Removes keyboard focus from the Reset button.

click()

Simulates a click on the Reset button.

focus()

Gives keyboard focus to the Reset button.

Event Handlers

onblur()

Invoked when the Reset button loses keyboard focus.

onclick()

Invoked when the Reset button is clicked.

onfocus()

Invoked when the Reset button is given keyboard focus.

HTML Syntax

A Reset element is created with a standard HTML <INPUT> tag, with the addition of the onClick attribute:

<FORM>
    ...
  <INPUT
    TYPE="reset"    specifies that this is a Reset button
    [ VALUE="label" ] the text that is to appear within the button
    specifies the value property
    [ NAME="name" ]   a name that can later be used to refer to the button
    specifies the name property
    [ onClick="handler" ] JavaScript statements to be executed when the button
    is clicked
  >
    ...
</FORM>

Description

The Reset element has the same properties and methods as the Button element, but has a more specialized purpose. When a Reset element is clicked on, all input elements in the form that contains it will have their values reset back to their initial default values. (For most elements this means to the value specified by the HTML VALUE attribute.) If no initial value was specified, then a click on the Reset button will "clear" any user input from those elements.

Usage

If no VALUE attribute is specified for a Reset element, it will be labelled Reset. In some forms, it may be better to label the button Clear Form or Defaults.

In Navigator 3.0, you can simulate the action of a Reset button with the reset() method of the Form object. Also in Navigator 3.0, the onreset() event handler of the Form object will be invoked before the form is reset. This event handler can cancel the reset by returning false.

See Also

"Button", "Element", "Form"


Previous Home Next
Radio.value Book Index Reset.blur()

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell

file: /Techref/language/JAVA/SCRIPT/definitive/refp_326.htm, 8KB, , updated: 2019/10/14 15:00, local time: 2024/12/29 12:06,
TOP NEW HELP FIND: 
18.216.126.33:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://massmind.ecomorder.com/techref/language/JAVA/SCRIPT/definitive/refp_326.htm"> [Chapter 21] Reference: Reset</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to ecomorder.com!

 

Welcome to massmind.ecomorder.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .