表单

表单元素格式

- html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>登录注册title>
- head>
- <body>
- <h1>注册h1>
- <form action="first.html" method="post">
- <p>名字:<input type="text" name="username">p>
- <p>密码:<input type="password" name="pwd">p>
- <p>
- <input type="submit">
- <input type="reset">
- p>
- form>
- body>
- html>
输出结果:
(1)get提交


(2)post提交(按住f12在network可以查看密码)




(1)文本框
(2)密码框
(3)单选框标签
- html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>登录注册title>
- head>
- <body>
- <h1>注册h1>
- <form action="first.html" method="post">
-
- <p>名字:<input type="text" name="username" value="haha" maxlength="8"/>p>
-
- <p>密码:<input type="password" name="pwd"/>p>
-
- <p>
- <input type="radio" value="man" name="sex"/>男
- <input type="radio" value="woman" name="sex"/>女
- p>
- <p>
- <input type="submit"/>
- <input type="reset"/>
- p>
- form>
- body>
- html>
输出结果:

按钮
例子:
- html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>登录注册title>
- head>
- <body>
- <h1>注册h1>
- <form action="first.html" method="post">
-
- <p>名字:<input type="text" name="username" value="haha" maxlength="8"/>p>
-
- <p>密码:<input type="password" name="pwd"/>p>
-
- <p>
- <input type="radio" value="man" name="sex"/>男
- <input type="radio" value="woman" name="sex"/>女
- p>
-
-
- <p>
- 爱好:
- <input type="checkbox" value="sleep" name="hobby"/>睡觉
- <input type="checkbox" value="code" name="hobby"/>敲代码
- <input type="checkbox" value="chat" name="hobby"/>聊天
- <input type="checkbox" value="game" name="hobby"/>游戏
- p>
-
- <p>
- 按钮:
- <input type="button" value="点击变长" name="but1"/>
- <input type="image" src="../resource/img/5efaffbac96db.jpg"/>
- p>
- <p>
- <input type="submit"/>
- <input type="reset"/>
- p>
- form>
- body>
- html>
输出结果:
