HTML基础教程之表单中的单行... 登录

HTML基础教程之表单中的单行文本域和密码域

单行文本域

语法格式:

<input  type = “text” 属性 = “值” />

常用属性

  • name:文本框的名字。命名规则是:可以包含字母、数字、下划线,只能以字母开头。

  • type:表单元素的类型。

  • value:文本框中的值。

  • size:文本框的长度,以“字符”为单位。

  • maxLength:最多可以输入多少个字符,超出的就输不进去了。

  • readonly:只读属性。可以选中,但不能修改。如:readonly = “readonly”

  • disabled:禁用属性。不能选中,不能修改。如: disabled = “disabled”

举例说明:

<input type="text" name="username" />


单行密码域

语法格式:

<input  type = “password” 属性 = “值”  />

常用属性

  • name:密码框的名字。命名规则是:可以包含字母、数字、下划线,只能以字母开头。

  • type:表单元素的类型。

  • value:元素中的值。

  • size:元素的长度,以“字符”为单位。

  • maxLength:最多可以输入多少个字符,超出的就输不进去了。

  • readonly:只读属性。可以选中,但不能修改。如:readonly = “readonly”

  • disabled:禁用属性。不能选中,不能修改。如: disabled = “disabled”


实例:

<!DOCTYPE HTML>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>用户注册</title>
    </head>
    <body>
        <font size="5" color="red">欢迎注册php.cn</font>
        <form name="user" method="get" action="" >
            用户名:<input type="text" name="username" value="请输入您的用户名" maxLength="6"/>
            <br/>
            密码:<input type="password" name="userpwd" maxLength="6"/>
            <br/>
            <input type="submit" value="提交信息"/>
        </form>
    </body>
</html>

大家也可以输入其他属性,查看结果

下一节
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>用户注册</title> </head> <body> <font size="5" color="red">欢迎注册php.cn</font> <form name="user" method="get" action="" > 用户名:<input type="text" name="username" value="请输入您的用户名" maxLength="6"/> <br/> 密码:<input type="password" name="userpwd" maxLength="6"/> <br/> <input type="submit" value="提交信息"/> </form> </body> </html>
提交 重置代码
章节 评论 笔记 课件
  • 取消 回复 发送
  • 取消 发布笔记 发送