zoukankan      html  css  js  c++  java
  • HTML DOM Password对象

    参考http://www.w3school.com.cn/jsref/dom_obj_password.asp

    属性         描述

    accessKey      设置或返回访问密码字段的快捷键。

    alt           设置或返回当不支持密码字段时显示的替代文字。

    defaultValue      设置或返回密码字段的默认值。

    disabled      设置或返回是否应被禁用密码字段。

    form         返回对包含此密码字段的表单的引用。

    id         设置或返回密码字段的 id。

    maxLength     设置或返回密码字段中字符的最大数目。

    name         设置或返回密码字段的名称。

    readOnly        设置或返回密码字段是否应当是只读的。

    size          设置或返回密码字段的长度。

    tabIndex      设置或返回密码字段的 tab 键控制次序。

    type         返回密码字段的表单元素类型。

    value         设置或返回密码字段的 value 属性的值。

    className     设置或返回元素的 class 属性。

    dir         设置或返回文本的方向。

    lang        设置或返回元素的语言代码。

    title        设置或返回元素的 title 属性。

    对象方法:  

    blur():从密码字段开始移开焦点;

    focus():为密码字段设置焦点;

    select():选取密码字段中的文本。

    for example:

    <html>
    <head>
    <script type="text/javascript">
    function setFocus()
      {
      document.getElementById('password1').focus()
      }
    function loseFocus()
      {
      document.getElementById('password1').blur()
      }
    function selectText()
      {
      document.getElementById('password1').select()
      }
    </script>
    </head>
    <body>
    
    <form>
    <input type="password" id="password1" value="thgrt456" />
    <input type="button" onclick="setFocus()" value="Set focus" />
    <input type="button" onclick="loseFocus()" value="Lose focus" />
    <input type="button" onclick="selectText()" value="select Text" />
    </form>
    
    </body>
    </html>
  • 相关阅读:
    BZOJ 2574: [Poi1999]Store-Keeper
    BZOJ 1024: [SCOI2009]生日快乐
    BZOJ 2541: [Ctsc2000]冰原探险
    hihoCoder 1303 数论六·模线性方程组
    Codeforces 710 D. Two Arithmetic Progressions
    BZOJ 1670: [Usaco2006 Oct]Building the Moat护城河的挖掘
    ZJOI2014 2048
    51Nod 1766 树上的最远点对
    Codeforces 727 F. Polycarp's problems
    BZOJ 3736: [Pa2013]Karty
  • 原文地址:https://www.cnblogs.com/Decmber/p/4755704.html
Copyright © 2011-2022 走看看