酷代码 AI
菜单

<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>环保网址系统登录注册页面</title> <style> body { font-family: arial, sans-serif; background-color: #f4f4f4; margin: 0; padding: 20px; } .container { max-width: 400px; margin: 50px auto; padding: 20px; background-color: #fff; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); } h2 { text-align: center; color: #333; } form {

以下是一个可能的登录注册表单的代码示例,包含用户名、密码、确认密码以及登录和注册按钮,并带有一些基本的验证逻辑: ```html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>环保网址系统登录注册页面</title> <style> body { font-family: arial, sans-serif; background-color: #f4f4f4; margin: 0; padding: 20px; } .container { max-width: 400px; margin: 50px auto; padding: 20px; background-color: #fff; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); } h2 { text-align: center; color: #333; } </style> </head> <body> <div class="container"> <h2>登录/注册</h2> <form action=""> <label for="username">用户名:</label><br> <input type="text" id="username" name="username"><br> <label for="password">密码:</label><br> <input type="password" id="password" name="password"><br> <label for="confirm-password">确认密码:</label><br> <input type="password" id="confirm-password" name="confirm-password"><br> <input type="submit" value="登录" onclick="login()"> <input type="submit" value="注册" onclick="register()"> </form> </div> <script> // 登录函数 function login() { // 获取用户名和密码 var username = document.getElementById('username').value; var password = document.getElementById('password').value; // 简单的用户名和密码验证 if (username === '' || password === '') { alert('用户名和密码不能为空!'); return; } // 这里可以添加与服务器通信的登录逻辑 alert('登录成功!'); } // 注册函数 function register() { // 获取用户名、密码和确认密码 var username = document.getElementById('username').value; var password = document.getElementById('password').value; var confirmPassword = document.getElementById('confirm-password').value; // 简单的用户名和密码验证 if (username === '' || password === '' || confirmPassword === '') { alert('用户名、密码和确认密码不能为空!'); return; } // 密码和确认密码一致性验证 if (password!== confirmPassword) { alert('密码和确认密码不一致!'); return; } // 这里可以添加与服务器通信的注册逻辑 alert('注册成功!'); } </script> </body> </html> ``` 额外需要注意的逻辑点: 1. 实际应用中,登录和注册与服务器的通信要使用安全的方式,如 HTTPS 协议。 2. 密码的存储要进行加密处理,不能以明文形式存储。 3. 用户名的唯一性验证要在服务器端进行,以确保没有重复的用户名。 [2024-12-15 23:28:41 | AI写代码神器 | 800点数解答]

服务商
相关提问
发财导航,免费问AI
实用工具查看更多