分享好友 资讯首页 资讯分类 切换频道

html注册登录源码

2025-10-28 16:3000

HTML代码。

html注册登录源码

<!DOCTYPE html>
<html>
<head>
    <title>注册和登录页面</title>
    <style>
        .container {
            margin-top: 50px;
        }
    </style>
</head>
<body>
    <div class="container">
        <h2>注册</h2>
        <form action="/register" method="post">
            <div>
                <label for="username">用户名:</label>
                <input type="text" id="username" name="username" required>
            </div>
            <div>
                <label for="password">密码:</label>
                <input type="password" id="password" name="password" required>
            </div>
            <button type="submit">注册</button>
        </form>
    </div>
    <div class="container">
        <h2>登录</h2>
        <form action="/login" method="post">
            <div>
                <label for="username">用户名:</label>
                <input type="text" id="username" name="username" required>
            </div>
            <div>
                <label for="password">密码:</label>
                <input type="password" id="password" name="password" required>
            </div>
            <button type="submit">登录</button>
        </form>
    </div>
</body>
</html>

这个页面包含两个表单,一个用于注册,一个用于登录,表单的action属性指向处理这些请求的后端URL(例如/register/login),而method属性设置为post,用于提交表单数据,每个表单都有两个输入字段:一个用于用户名,一个用于密码,这两个字段都是必需的,所以设置了required属性,提交按钮使用type="submit"来提交表单,这只是一个基本的示例,实际的注册和登录过程需要更多的验证和安全措施。

html注册登录源码

举报
收藏 0
打赏 0
评论 0
 
友情链接