GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [html] 第127天 html的button中的reset有什么作用? · Issue #1092 · haizlin/fe-interview

[html] 第127天 html的button中的reset有什么作用? #1092

New issue
Copy link
New issue
Copy link
Open
Open
[html] 第127天 html的button中的reset有什么作用?#1092
Copy link
Labels
htmlhtml

Description

@haizhilin2013
haizhilin2013
opened on Aug 20, 2019
Issue body actions

第127天 html的button中的reset有什么作用?

Activity

  1. haizhilin2013
    added
    htmlhtml
    on Aug 20, 2019
  2. LinStan commented on Aug 21, 2019

    @LinStan
    LinStan
    on Aug 21, 2019
    More actions

    <button type='reset' />
    需要配合form使用
    一般用于后台管理系统或者登陆注册页面等包含表单的地方,设为reset的button在点击后会将包含他的表单中的所有用户输入都重置为value指定的默认值。

  3. xxf1996 commented on Aug 21, 2019

    @xxf1996
    xxf1996
    on Aug 21, 2019
    More actions

    type="reset"的button,点击后可以重置当前表单内所有的input为初始值。

  4. whitesky1225 commented on Aug 21, 2019

    @whitesky1225
    whitesky1225
    on Aug 21, 2019
    More actions

    重置当前所在表单内input的的值为初始值

  5. EragonBubble commented on Aug 21, 2019

    @EragonBubble
    EragonBubble
    on Aug 21, 2019
    More actions

    button.type="reset" ,重置按钮,即清除表单数据。与form表单配合使用。demo如下:

    <form action="form_action.asp" method="get">
      First name: <input type="text" name="fname" />
      Last name: <input type="text" name="lname" />
      <button type="submit" value="Submit">Submit</button>
      <button type="reset" value="Reset">Reset</button>
    </form>
    
  6. EmiyaYang commented on Aug 21, 2019

    @EmiyaYang
    EmiyaYang
    on Aug 21, 2019
    More actions

    顺便梳理了一下html设置各类表单元素默认值的方法

    <form>
      <div>
        Select: 
        <select name="cars">
          <option value="volvo">Volvo</option>
          <option value="saab"  selected = "selected" >Saab</option>
          <option value="fiat">Fiat</option>
          <option value="audi">Audi</option>
        </select>
      </div>
      <div>
        Input: 
        <input type="text" name="name" value="123" />
      </div>
      <div>
        CheckBox: 
        <input name="role" type="radio" checked="checked" value="0"/>
        <input name="role" type="radio" value="1"/>
      </div>
      <button type="reset">reset</button>
    </form>
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    htmlhtml

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402792 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.