现在的位置: 首页 > 综合 > 正文

《HTML5 从入门到精通–9.3.2 密码域——password》

2013年03月07日 ⁄ 综合 ⁄ 共 762字 ⁄ 字号 评论关闭

  在表单中还有一种文本域的形式——密码域,输入到该文本的文字均以“*”或圆点显示。

语法

<input type="password" name="控件名称" size="控件的长度" maxlength="最长字符数" value="文字字段的默认取值"  />

语法解释

该语法包含了很多参数,它们的含义和取值如表9.4所示。其中name、size、maxlength参数是必选。

                                       表9.4  password密码域的参数表

HTML5

例9.2   实例代码

<html>
<head>
<title>插入密码域</title>
</head>
<body>
<h1>用户调整</h1>
     <form action="
mailto:798033502@qq.com" method="get"
name="register">
         姓名:<input type="text" name="username" size="20" />
          <br/><br/>
         密码:<input type="password" name="password" size="20" maxlength="8"   />
          <br/><br/>
         确定密码:<input type="password" name="password" size="20" maxlength="8"  />
     </form>
</body>
</html>

  运行这段代码,在页面中的密码文本域中输入密码,可以看出现在文本框中的内容不是字符本身,而是“*”,如图9.2所示。

HTML5

                                             图9.2  在密码域中输入字符

 

 

 

 

抱歉!评论已关闭.