用Javascript写一个登录页面
时间: 2024-04-29 19:21:45 浏览: 3
好的,以下是一个简单的登录页面示例:
```html
<!DOCTYPE html>
<html>
<head>
<title>Login Page</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
font-family: Arial, sans-serif;
background-color: #f2f2f2;
}
form {
background-color: #ffffff;
padding: 20px;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0,0,0,0.2);
max-width: 400px;
margin: 0 auto;
margin-top: 50px;
}
input[type="text"], input[type="password"] {
padding: 10px;
margin-bottom: 20px;
border-radius: 5px;
border: none;
box-shadow: 0 0 5px rgba(0,0,0,0.2);
width: 100%;
}
input[type="submit"] {
background-color: #4CAF50;
color: #ffffff;
padding: 10px;
border: none;
border-radius: 5px;
cursor: pointer;
width: 100%;
font-size: 16px;
}
input[type="submit"]:hover {
background-color: #3e8e41;
}
h1 {
text-align: center;
}
</style>
</head>
<body>
<form>
<h1>Login</h1>
<label for="username">Username:</label>
<input type="text" id="username" name="username" placeholder="Enter your username">
<label for="password">Password:</label>
<input type="password" id="password" name="password" placeholder="Enter your password">
<input type="submit" value="Login">
</form>
</body>
</html>
```
这个页面包含一个表单,其中包含用户名和密码字段以及提交按钮。当用户点击“登录”按钮时,表单数据将被发送到服务器进行验证。请注意,这只是一个简单的示例,实际的登录页面需要更多的安全措施和验证步骤来确保用户信息的安全。