用gpt写的登录页面

<!DOCTYPE html>
<html>

<head>
  <title>登录页面</title>
  <style>
    body {
     
      font-family: Arial, sans-serif;
      background-color: #f4f4f4;
      margin: 0;
      padding: 0;
    }

    .container {
     
      max-width: 400px;
      margin: 0 auto;
      padding: 20px;
      background-color: #fff;
      border-radius: 5px;
      box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
      margin-top: 100px;
    }

    h1 {
     
      text-align: center;
    }

    .form-group {
     
      margin-bottom: 20px;
    }

    label {
     
      display: block;
      margin-bottom: 5px;
    }

    input[type="text"],
    input[type="password"] {
     
      width: 100%;
      padding: 10px;
      border: 1px solid #ccc;
      border-radius: 4px;
    }

    button {
     
      display: block;
      width: 100%;
      padding: 10px;
      background-color: #4caf50;
      color: #fff;
      border: none;
      border-radius: 4px;
      cursor: pointer;
    }

    button:hover {
     
      background-color: #45a049;
    }
  </style>
</head>

<body>
  <div class="container">
    <h1>登录</h1>
    <form id="loginForm">
      <div class="form-group">
        <label for="username">用户名:</label>
        <input type="text" id="username" placeholder="请输入用户名">
      </div>
      <div class="form-group">
        <label for="password">密码:</label>
        <input type="password" id="password" placeholder="请输入密码">
      </div>
      <button type="submit">登录</button>
    </form>
    <div style="text-align: center; margin-top: 20px;">
      <span>还没有账号?</span>
      <button id="registerButton">注册</button>
    </div>
  </div>

  <script>
    // 获取表单和输入字段的引用
    const form = document.getElementById("loginForm");
    const usernameInput = document.getElementById("username");
    const passwordInput = document.getElementById("password");
    const registerButton = document.getElementById("registerButton");

    // 表单提交事件处理程序
    form.addEventListener("submit", function (event) {
     
      event.preventDefault(); // 阻止表单默认提交行为

      // 获取输入字段的值
      const username = usernameInput.value;
      const password = passwordInput.value;

      // 进行验证,这里只是简单示例

      // 登录成功,跳转到首页
      window.location.href = "index.html";

    });

    // 注册按钮点击事件处理程序
    registerButton.addEventListener("click", function(event) {
     
      window.location.href = "register.html";
    });
  </script>
</body>

</html>

相关推荐

  1. gpt登录页面

    2024-01-09 12:34:01       30 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-01-09 12:34:01       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-01-09 12:34:01       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-01-09 12:34:01       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-01-09 12:34:01       20 阅读

热门阅读

  1. C++ 数据结构

    2024-01-09 12:34:01       28 阅读
  2. 若依 模态框调整

    2024-01-09 12:34:01       32 阅读
  3. Python Unicode 系统

    2024-01-09 12:34:01       34 阅读
  4. 算法每日一题:回旋镖的数量 | 坐标距离 | 哈希

    2024-01-09 12:34:01       36 阅读
  5. 网络安全之文件上传

    2024-01-09 12:34:01       34 阅读
  6. 展开运算符(Spread Operator)

    2024-01-09 12:34:01       34 阅读
  7. 在Python中创建一个动漫风格的皮卡丘

    2024-01-09 12:34:01       36 阅读
  8. NumPy 高级教程——GPU 加速

    2024-01-09 12:34:01       37 阅读
  9. 80. 删除有序数组中的重复项 II

    2024-01-09 12:34:01       33 阅读