求用HTML做一个登陆页面
求用HTML做一个登陆页面qwq<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>login</title>
</head>
<body>
<h1>登录</h1>
<form>
账号:<input type="text" name="name">
密码:<input type="password" name="password">
</form>
<button type="button" onclick="find()">登录</button>
<script>
function find(){
var search_name = document.getElementById("search_name").value;
var password = localStorage.getItem(search_password);
var find_result = document.getElementById("find_result");
find_result.innerHTML = search_site + "test" + siteurl;
}
</script>
<h1>注册</h1>
<form>
账号:<input type="text" name="name">
密码:<input type="password" name="password">
</form>
<button type="button" onclick="save()">注册</button>
<script>
function save(){
var password = document.getElementById("password").value;
var name = document.getElementById("name").value;
localStorage.setItem(name, password);
alert("注册成功");
}
function loadAll(){
var list = document.getElementById("list");
if(localStorage.length>0){
var result = "<table border='1'>";
result += "<tr><td>key</td><td>value</td></tr>";
for(var i=0;i<localStorage.length;i++){
var name = localStorage.key(i);
var password = localStorage.getItem(password);
result += "<tr><td>"+name+"</td><td>"+password+"</td></tr>";
}
result += "<table></table>";
list.innerHTML = result;
}else{
list.innerHTML = "数据为空……";
}
}
</script>
</body>
</html>
这是我做的,失败了qaq
看看这个 本帖最后由 MingHaoGame 于 2022-6-11 20:06 编辑
看看这个index.html
<!DOCTYPE html>
<html lang="zh-CN"><!--BY:MingHaoGame-->
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>登陆 作者:MingHaoGame</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="box">
<h2>登陆</h2>
<div class="input-box">
<label>账号</label>
<input type="text"/>
</div>
<div class="input-box">
<label>密码</label>
<input type="password"/>
</div>
<div class="btn-box">
<a href="#">忘记密码?</a>
<div>
<button>登录</button>
<button>注册</button><!--BY:MingHaoGame-->
</div>
</div>
</div>
<script type="text/javascript">
</script>
</body>
</html>style.css
* {
margin: 0;
padding: 0;
}
body {
height: 100vh;
background: url(image/bg.png) no-repeat;
background-size: cover;
display: flex;
justify-content: center;
align-items: center;
}
.box {
width: 350px;
height: 350px;
border-top: 1px solid rgba(255,255,255,0.5);
border-left: 1px solid rgba(255,255,255,0.5);
border-bottom: 1px solid rgba(255,255,255,0.3);
border-right: 1px solid rgba(255,255,255,0.3);
backdrop-filter: blur(10px);
background: rgba(50,50,50,0.2);
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
border-radius: 10px;
}
.box > h2 {
color: rgba(255,255,255,0.9);
margin-bottom: 30px;
}
.box .input-box {
display: flex;
flex-direction: column;
box-sizing: border-box;
margin-bottom: 10px;
}
.box .input-box label {
font-size: 13px;
color: rgba(255,255,255,0.9);
margin-bottom: 5px;
}
.box .input-box input {
letter-spacing: 1px;
font-size: 14px;
box-sizing: border-box;
width: 250px;
height: 35px;
border-radius: 5px;
border: 1px solid rgba(255,255,255,0.5);
background: rgba(255,255,255,0.2);
outline: none;
padding: 0 12px;
color: rgba(255,255,255,0.9);
transition: 0.2s;
}
.box .input-box input:focus {
border: 1px solid rgba(255,255,255,0.8);
}
.box .btn-box {
width: 250px;
display: flex;
flex-direction: column;
align-items: start;
}
.box .btn-box > a {
outline: none;
display: block;
width: 250px;
text-align: end;
text-decoration: none;
font-size: 13px;
color: rgba(255,255,255,0.9);
}
.box .btn-box > a:hover {
color: rgba(255,255,255,1);
}
.box .btn-box > div {
margin-top: 10px;
display: flex;
justify-content: center;
align-items: center;
}
.box .btn-box > div > button {
outline: none;
margin-top: 10px;
display: block;
font-size: 14px;
border-radius: 5px;
transition: 0.2s;
}
.box .btn-box > div > button:nth-of-type(1) {
width: 120px;
height: 35px;
color: rgba(255,255,255,0.9);
border: 1px solid rgba(192, 119, 91, 0.7);
background: rgba(192, 119, 91, 0.5);
}
.box .btn-box > div > button:nth-of-type(2) {
width: 120px;
height: 35px;
margin-left: 10px;
color: rgba(255,255,255,0.9);
border: 1px solid rgba(192, 119, 91, 0.7);
background: rgba(192, 119, 91, 0.5);
}
.box .btn-box > div > button:hover {
border: 1px solid rgba(251, 128, 71, 0.7);
background: rgba(251, 128, 71, 0.5);
}
已成功<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>login</title>
</head>
<body>
<h1>登录</h1>
<form>
<table>账号:<input type="text" id="search_name" name="name"></table>
<table>密码:<input type="password" id="search_password" name="password"></table>
</form>
<button type="button" onclick="find()">登录</button>
<button type="button" onclick="save()">注册</button>
<scripttype="text/javascript">
function find(){
var search_name = document.getElementById("search_name").value;
var password = document.getElementById("search_password").value;
var localstorageget = localStorage.getItem(search_name) ;
if (password===localstorageget){
alert("登录成功");
} else {
alert("登录失败");
}
}
function save(){
var password = document.getElementById("search_password").value;
var name = document.getElementById("search_name").value;
localStorage.setItem(name, password);
alert("注册成功");
}
</script>
</body>
</html>
本帖最后由 小永高呐 于 2023-9-21 10:22 编辑
给你个我这的,不过只是空按钮,需要自己对接下后端才可以用
预览:https://download.kstore.space/download/5005/yanshi/login.html
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>登录本站</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {
font-size: 10px;
}
html::before {
content: '';
width: 100%;
height: 100%;
position: fixed;
z-index: -1;
}
::selection {
color: #fff;
background-color: rgb(144,129,241);
}
.box {
display: flex;
overflow: hidden;
width: 90rem;
height: 55rem;
background-color: rgba(255,255,255,70%);
border-radius: 1.5rem;
margin: 10% auto;
box-shadow: 0 0 1rem 0.2rem rgb(0 0 0 / 10%);
}
.box .left {
position: relative;
width: 35%;
height: 100%;
}
.box .left::before {
content: '';
position: absolute;
width: 100%;
height: 100%;
background-image: url(https://xiaoyonggaoya.pages.dev/login/login-tp.png);
background-size: cover;
}
.box .right {
display: flex;
width: 65%;
flex-direction: column;
align-items: center;
}
.box .right h2{
color: rgb(144,129,241);
font-size: 3rem;
margin-top: 5rem;
}
.box .right form {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.box .right form .acc {
outline: none;
width: 80%;
height: 5rem;
font-size: 1.6rem;
margin-top: 5rem;
padding: 1rem 0 0 1.6rem;
border: none;
border-bottom:1px solid rgb(144,129,241) ;
color: rgb(144,129,241);
background-color: rgba(0,0,0,0);
}
.right form .acc:focus {
outline: none;
color: rgb(144,129,241);
padding: 1rem 0 0 1.6rem;
}
.right .submit {
width: 60%;
height: 5rem;
color: #f6f6f6;
background-image: linear-gradient(120deg, #e0c3fc 0%, #8ec5fc 100%);
font-size: 1.4rem;
border: none;
border-radius: 0.5rem;
margin: 6rem 0 0 50%;
transform: translateX(-50%);
}
.right .submit:hover {
box-shadow: 0 0 2rem -0.5rem rgb(0 0 0 / 15%);
}
.right .fn {
display: flex;
justify-content: space-between;
margin-top: 1rem;
width: 70%;
}
.right .fn font {
font-size: 1.3rem;
margin-top: 5rem;
padding: 1rem 2rem;
color: #666;
}
.right .fn font:hover {
color: rgb(144,129,241);
}
</style>
<script>
function meshinaxidadedog(){
alert("账号登录成功!");}
function kleeworldfirstcute(){
alert("抱歉,注册功能还未开放!");}
function yoimiyadedidudiduzbc(){
alert("抱歉,找回密码功能还未开放");}
</script>
<link rel="icon" href="https://xiaoyonggaoya.pages.dev/live/img/icon.jpg">
</head>
<body background="https://xiaoyonggaoya.pages.dev/login/bg.jpg" style="overflow:hidden;background-repeat:no-repeat;background-size:100%100%;background-attachment:fixed;">
<div class="box">
<div class="left"></div>
<div class="right">
<h2>登 录</h2>
<form action="">
<input class="acc" type="text" placeholder="用户名">
<input class="acc" type="password" placeholder="密码">
<input class="submit" type="submit" value="登录账号" onclick="meshinaxidadedog()">
</form>
<div class="fn">
<font onclick="yoimiyadedidudiduzbc()">找回密码</font>
<font onclick="kleeworldfirstcute()">注册账户</font>
</div></div></div>
</body>
</html> 你的第11行的div标签好像还差一个结束标签 小永高呐 发表于 2023-9-20 16:31
给你个我这的,不过只是空按钮,需要自己对接下后端才可以用
预览:https://download.kstore.space/downlo ...
谢谢,但是这是早期的问题。
页: [1]