马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
<!DOCTYPE html>
<html lang="en">
<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>Document</title>
<style>
label{
width:50px;
display:inline-block;
text-align:left;
}
form{
width:260px;
height:100px;
background-color:aqua;
text-align:center;
}
</style>
</head>
<body>
<h1>试试看,能否登入自己qq</h1>
<form action="#" method="get">
<label>qq:</label><input type="text" name="usname" placeholder="请输入qq号" class="iptone" >
<label>密码:</label><input type="password" placeholder="请输入密码" name="password" class="ipttwo" >
<input type="submit" value="登录" class="submit">
</form>
<ul class="ulul">
</ul>
</body>
<script>
const iptone=document.querySelector('.iptone');
const ipttwo=document.querySelector('.ipttwo');
const submit=document.querySelector('.submit');
const ulul=document.querySelector('ulul');
submit.addEventListener('click',function(){
var datao= iptone.value;
var datat=ipttwo.value;
var dataall=datao+'+'+datat;
var local=getdata();
local.push(dataall);
savadate(local);
})
function getdata(){
var data=localStorage.getItem('usename');
if(data!==null){
return JSON.parse(data);
}
else{
return [];
}
}
function savadate(data){
loaclStorage.setItem('usename',JSON.stringify(data));
}
</script>
</html>
|