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>
  • 相关阅读:
    java 递归函数
    iOS安全攻防(三):使用Reveal分析他人app
    mapreduce任务失败、重试、猜測式运行机制小结
    javascript UniqueID属性
    弧度和角度的转换
    批处理批量创建90个用户
    【设计模式】状态模式
    【.NET进程通信】初探.NET中进程间通信的简单的实现
    天将降大任于斯人也,必先苦其心志,劳其筋骨,饿其体肤,空乏其身,行拂乱其所为,所以动心忍性,增益其所不能
    冷门却使用的 javascript 技巧
  • 原文地址:https://www.cnblogs.com/Decmber/p/4755704.html
Copyright © 2011-2022 走看看