工具推荐

视频效率加速
Seko
Seko

AI短剧一键生成成片

剧云
剧云

中文短剧剧本制作平台

updream

一键生成高质量推广成片

Laper
Laper

剧本策划到成片协作

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>
提交重置代码
章节
课件
捐赠

HTML+CSS基础入门教程

  • 评论
  • 课件下载

看山看水看代码

基本就是学习其中的属性

10年前      0

我是灰太狼

这讲解的很详细,能看懂能明白

10年前      0

baby不要哭泣

密码输入是不显示的,可以设置

10年前      0

看透不说透

<input type="text"> 这个是文本框 也是可以写结束的 <input></input>

10年前      0

尼古拉阿列克塞耶维奇奥斯特洛夫斯基

记住常用属性

10年前      0

课件暂不提供下载,工作人员正在整理中,后期请多关注该课程~