form表单做一个登录页面,
时间: 2023-08-23 08:05:03 浏览: 54
好的,以下是一个简单的登录页面的HTML代码:
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>登录页面</title>
</head>
<body>
<h2>用户登录</h2>
<form action="login.php" method="post">
<label for="username">用户名:</label>
<input type="text" id="username" name="username"><br><br>
<label for="password">密码:</label>
<input type="password" id="password" name="password"><br><br>
<input type="submit" value="登录">
</form>
</body>
</html>
```
在这个登录页面中,我们使用`form`标签来创建一个表单,并设置了`action`为`login.php`,表示当用户点击登录按钮时,会将表单的数据提交到`login.php`页面进行处理。同时,我们使用了`method`属性来指定表单的提交方式为`post`,这意味着表单数据会被封装到HTTP请求的消息体中,而不是放在URL中。
表单中有两个输入框,一个是用户名,一个是密码,分别使用了`input`标签来创建,其中`type`属性设置为`text`和`password`,分别表示输入框的类型为文本输入和密码输入。`id`属性和`name`属性分别用来标识输入框,`for`属性用来关联输入框和对应的标签。
最后,使用了`input`标签来创建一个提交按钮,`type`属性设置为`submit`,表示这是一个提交按钮。