`
ilusm
  • 浏览: 106550 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

JavaScript:reset object

阅读更多

reset object

A reset button on an htm form. A reset button resets all elements in a form to their defaults.

语法

To define a reset button, use standard htm 语法 with the addition of the onClick event handler:

<INPUT
   TYPE="reset"
   NAME="resetName"
   VALUE="buttonText"
   [onClick="handlerText"]>

NAME="resetName" specifies the name of the reset object. You can access this value using the name property. VALUE="buttonText" specifies the text to display on the button face. You can access this value using the value property.

To use a reset object's properties and 用法:

1. resetName.propertyName
2. resetName.methodName(parameters)
3. formName.elements[index].propertyName
4. formName.elements[index].methodName(parameters)

resetName is the value of the NAME attribute of a reset object. formName is either the value of the NAME attribute of a form object or an element in the forms array. index is an integer representing a reset object on a form. propertyName is one of the properties listed below. methodName is one of the 用法 listed below.

Property of

  • form

    描述

    A reset object on a form looks as follows:

    A reset object is a form element and must be defined within a <FORM> tag.

    The reset button's onClick event handler cannot prevent a form from being reset; once the button is clicked, the reset cannot be canceled.

    Properties

  • name reflects the NAME attribute
  • value reflects the VALUE attribute

    用法

  • click

    Event handlers

  • onClick

    例子

    Example 1. The following example displays a text object with the default value "CA" and a reset button with the text "Clear Form" displayed on its face. If the user types a state abbreviation in the text object and then clicks the Clear Form button, the original value of "CA" is restored. 

    <B>State: </B><INPUT TYPE="text" NAME="state" VALUE="CA" SIZE="2">
    <P><INPUT TYPE="reset" VALUE="Clear Form">

      
    Example 2. The following example displays two text objects, a select object, and three radio buttons; all of these objects have default values. The form also has a reset button with the text "Defaults" on its face. If the user changes the value of any of the objects and then clicks the Defaults button, the original values are restored. 

    <htm>
    <HEAD>
    <TITLE>Reset object example</TITLE>
    </HEAD>
    <BODY>
    <FORM NAME="form1">
    <BR><B>City: </B><INPUT TYPE="text" NAME="city" VALUE="Santa Cruz" SIZE="20">
    <B>State: </B><INPUT TYPE="text" NAME="state" VALUE="CA" SIZE="2">
    <P><SELECT NAME="colorChoice">
    <OPTION SELECTED> Blue
    <OPTION> Yellow
    <OPTION> Green
    <OPTION> Red
    </SELECT>
    <P><INPUT TYPE="radio" NAME="musicChoice" VALUE="soul-and-r&b"
    CHECKED> Soul and R&B
    <BR><INPUT TYPE="radio" NAME="musicChoice" VALUE="jazz">
    Jazz
    <BR><INPUT TYPE="radio" NAME="musicChoice" VALUE="classical">
    Classical
    <P><INPUT TYPE="reset" VALUE="Defaults" NAME="reset1">
    </FORM>
    </BODY>
    </htm>
    

     

    相关

  • button, form, and submit objects
  • 分享到:
    评论

    相关推荐

      MetaSetter:Singleton Object可动态更新客户端应用程序中的元标记

      单例模式每当您require('meta-setter') ,它将在所有位置返回相同的javascript对象。 这称为。为什么这有用? MetaSetter对象是一个简单的单例对象,具有3种方法:init,updateMetaTags和Reset。 MetaSetter在客户端...

      JavaScript语言参考手册

      内含: JavaScript语言参考手册.pdf (主要资源) 另外附上: ...netscape.javascript.JSObject 方法和静态方法 netscape.javascript.JSException 构造函数 netscape.plugin.Plugin 构造函数和方法 索引

      JavaScript权威指南

      Object-Oriented JavaScript Section 8.6. Objects as Associative Arrays Section 8.7. Object Properties and Methods Chapter 9. Arrays Section 9.1. Arrays and Array Elements Section 9.2. ...

      JavaScript中文参考手册

      【下一章】 【索引】 【这是目录】 ---------------------------------------...netscape.javascript.JSObject 方法和静态方法 netscape.javascript.JSException 构造函数 netscape.plugin.Plugin 构造函数和方法

      Frame:用于 Javascript 的 Sprite Sheet 库

      用于 Javascript 的 Sprite Sheet 库 画布元素必须在页面上。 这将使用找到的第一个。 请注意,您的 spritesheet 必须是一长条帧,以自动计算出您有多少帧。 //load your images into native image objects. var ...

      object-subscribe:订阅对对象的更改

      npm install object-subscribe 创建并订阅对象 创建一个对象: var person = { name : 'Joey' , age : 3 } ; 订阅对对象所做的更改: Obj . subscribe ( person , function ( newPersonObject , whatChanged ) ...

      ASP.NET程序中常用的三十三种代码.txt

      &lt;script language="javascript" for="document" event="onkeydown"&gt;  if (event.keyCode==13 && event.srcElement.type!=’button’ && event.srcElement.type! =’submit’ && event.srcElement.type!=’reset’ &...

      ASP.NET常用代码

      &lt;script language="javascript" for="document" event="onkeydown"&gt; if(event.keyCode==13 && event.srcElement.type!='button' && event.srcElement.type!='submit' && event.srcElement.type!='reset' && event....

      jQuery详细教程

      某些其他 JavaScript 库中的函数(比如 Prototype)同样使用 $ 符号。 jQuery 使用名为 noConflict() 的方法来解决该问题。 var jq=jQuery.noConflict(),帮助您使用自己的名称(比如 jq)来代替 $ 符号。 亲自试一...

      property-replacer:编写单元测试,您可以安全地替换对象属性并在拆卸时撤消替换。 受 perl 测试的启发

      编写 javascript 单元测试,您可以在其中安全地替换对象属性并在拆卸时撤消替换。 受 perl Test::Resub 和 python redef 的启发 安装 npm install property-replacer 用法 Replacer.replace(object, key, any); --&...

      Rave Player网页视频播放器

      Edited wimpy button bridge to include a function to reset buttons when done. v 4.1.3 (Nov. 7, 2009) - Added wimpy_button_reg.txt capabilities v 4.1.2 (Sept. 22, 2009) - Fixed "stop other sounds" ( ...

      jsp新闻发布系统

      &lt;script language="JavaScript" type="text/JavaScript"&gt; &lt;!-- function MM_reloadPage(init) { //reloads the window if Nav4 resized if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt...

      出现问题a is defined高手帮忙

      &lt;script type="text/javascript"&gt; //实现框选放大缩小功能 function DragZoomControl(opts_boxStyle, opts_other, opts_callbacks) { this.globals = { draggingOn: false, cornerTopDiv: null, ...

      uzhnu后端

      api/user/resetPassword (POST). Add email to body.3. api/user/:userId (GET). Return detail user object消息1. api/news/ (GET). Pagination works on this route. Query: *limit* *page*. Returrn news and ...

      Loggaby:simple一个简单,轻巧和可定制的记录器

      罗格比 :memo: 一个简单,轻巧和可定制的记录器。 Loggaby是简单,轻巧和最小的记录器。... (默认: true ) format {String}日志外观的格式(默认值: '{grey}{time}{reset} {level} &gt; ' ) levels {Object []}

      网上图书销售数据库+ASP

      '-------------------------------------------------------------------- ' Microsoft ADO ' ...' ' ' ' ADO constants include file for VBScript ' '------------------------------------------------------------...

      simple-tags

      * Fix conflict with plugin using Google Library Javascript for jQuery. Example : "Use Google Libraries" * Add an option for choose input text or textarea for old tags field * Add an option for min ...

      天涯易栈VC++网页操作类

      //获取指定索引按钮(Button)的类型(type),“button”、“submit”、“reset” /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~以下为网页Div~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ int GetDivCount();//返回网页内...

      酷炫的爆栈网源码.zip

      JSON (JavaSript Object Notation) AJAX (Asynchronous JavaScript and XML) Selector Priority Specificity Box Model W3C HTML CSS ...

    Global site tag (gtag.js) - Google Analytics