jquery登录页模版实现记住密码功能

 login.less样式

#Login {width: 100%;height: 100vh;background: url(../images/bg.png) no-repeat;background-size: 100% 100%;display: flex;justify-content: center;.container {display: inline-block;width: 4.64rem;height: 4.7rem;// padding: .2rem;border: 1px solid #ccc;border-radius: .1rem;background-color: #ffffff;margin-top: 3.2rem;.text{font-family: PingFangSC-Medium;font-size: .36rem;color: #222222;letter-spacing: 0;text-align: center;line-height: .36rem;font-weight: 500;margin: .5rem 0 .5rem 0;}.form-group {display: flex;width: 3.6rem;height: .4rem;background: #FFFFFF;border: 1px solid rgba(0,0,0,0.09);border-radius: .08rem;margin: 0 auto;display: flex;align-items: center;.icon{width: .26rem;height: .26rem;   margin: 0 .25rem;position: relative;}.icon1{background: url(../images/user.png) no-repeat;background-size: 100% 100%;}.icon2{background: url(../images/passworld.png) no-repeat;background-size: 100% 100%;}.icon::before{display: block;position: absolute;content: '';width: 1px;height: .16rem;background: #D6D8DB;left: .5rem;top: 50%;transform: translate(0,-50%);}input[type="text"],input[type="password"] {width: 80%;height: 100%;box-sizing: border-box;border: none;outline: none;border: none;border-radius: .08rem;// border: 1px solid red;font-family: PingFangSC-Regular;font-size: .16rem;color: #000;font-weight: 400;text-indent: .08rem;}input[type="text"]::-webkit-input-placeholder,input[type="password"]::-webkit-input-placeholder { /* Chrome、Safari、Opera */color: #999999;}input[type="text"]:-moz-placeholder,input[type="password"]::-webkit-input-placeholder { /* Firefox 18- */color: #999999;}input[type="text"]::-moz-placeholder,input[type="password"]::-webkit-input-placeholder { /* Firefox 19+ */color: #999999;}input[type="text"]:-ms-input-placeholder,input[type="password"]::-webkit-input-placeholder { /* IE/Edge */color: #999999;}}.form-group:nth-child(1){margin-bottom: .3rem;}.rememberBox{width: 3.6rem;display: flex;align-items: center;font-family: PingFangSC-Regular;font-size: .16rem;color: #666666;font-weight: 400;margin: 0 auto;margin-top: .15rem;margin-bottom: .43rem;#rememberMe{width: .2rem;height: .2rem;border: 1px solid #DADADA;border-radius: .04rem;margin-right: .12rem;}}.submit{width: 3.6rem;height: .5rem;margin: 0 auto;display: flex;input[type="submit"] {width: 100%;height: .5rem;border: none;background: #176EC7;border-radius: .08rem;font-family: PingFangSC-Medium;font-size: .16rem;color: #FFFFFF;font-weight: 500;cursor: pointer;}input[type="submit"]:hover {background-color: #0056b3;}}}}

reset.css

/* http://meyerweb.com/eric/tools/css/reset/v2.0 | 20110126License: none (public domain)
*/@font-face {font-family: 'pfm';src: url('../fonts/PingFangMedium.ttf');
}@font-face {font-family: 'pfsr';src: url('../fonts/PingFang SC Regular.ttf');
}html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {margin: 0;padding: 0;border: 0;font: inherit;vertical-align: baseline;
}/* HTML5 display-role reset for older browsers */
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {display: block;
}html,
body {/* line-height: 1; */font-size: 100px;
}ol,
ul {list-style: none;
}blockquote,
q {quotes: none;
}blockquote:before,
blockquote:after,
q:before,
q:after {content: '';content: none;
}table {border-collapse: collapse;border-spacing: 0;
}a {text-decoration: none;color: #999999;}/*滚动条美化*/
.scroll::-webkit-scrollbar {width: 6px;height: 6px;
}.scroll::-webkit-scrollbar-track {background-color: #002D62;-webkit-border-radius: 2em;-moz-border-radius: 2em;border-radius: 2em;
}.scroll::-webkit-scrollbar-thumb {background-color: #335781;-webkit-border-radius: 2em;-moz-border-radius: 2em;border-radius: 2em;
}

reset.js


$(window).resize(function(){        //  监控窗口宽度变化let width=$(window).width()let size=(100*width)/1920$(document.body).css('font-size',size+'px')$('html').css('font-size',size+'px')});window.onload = function() {let width = $(window).width()let size = (100 * width) / 1920$(document.body).css('font-size', size + 'px')$('html').css('font-size', size + 'px')
}

html

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Textarea 实时替换空格为 &amp;nbsp;</title><link rel="stylesheet" href="./css/reset.css"><link rel="stylesheet" href="./css/login.css">
</head><body><div id="Login"><div class="container"><div class="text">用户登录</div><form id="loginForm"><div class="form-group"><label for="username"><div class="icon icon1"></div></label><input type="text" placeholder="请输入用户名" id="username" name="username"></div><div class="form-group"><label for="password"><div class="icon icon2"></div></label><input type="password" placeholder="请输入密码" id="password" name="password"></div><div class="rememberBox"><input type="checkbox" id="rememberMe" name="rememberMe"><label for="rememberMe">记住密码</label></div><div class="submit"><input type="submit" value="登录"></div></form></div></div>
</body>
<script src="./js/jquery.min.js"></script>
<script src="./js/reset.js"></script>
<script>$(document).ready(function () {echoLoginInfo()// 模拟登录功能,这里只是简单的提示$('#loginForm').submit(function (event) {// 将账户名和密码存储在localStorage中// 获取输入的用户名和密码var username = $('#username').val();var password = $('#password').val();// 判断是否勾选了“记住密码”var rememberMe = $('#rememberMe').is(':checked');console.log(rememberMe,"===");//记住用户名localStorage.setItem('username', username);//判断是否记住密码if (rememberMe) {localStorage.setItem('password', password);} else {localStorage.removeItem('password'); // 如果用户没有选中记住密码选项,则清除localStorage中的密码信息}// 这里可以加入实际的登录验证逻辑,这里只是简单的弹出提示if (username && password) {alert('Username: ' + username + '\nPassword: ' + password + '\nRemember Me: ' + rememberMe);} else {alert('Please enter username and password.');}});});//判断密码账号是否在local里,在的话回显账号密码function echoLoginInfo() {const username = localStorage.getItem('username');const password = localStorage.getItem('password');if (username && password) {//这里当有密码和账号同事存在时候回显$('#username').val(username);$('#password').val(password);$('#rememberMe').prop('checked', true);} else {$('#username').val(username);$('#password').val('');$('#rememberMe').prop('checked', false);}}
</script></html>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/511639.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【Python】matplotlib绘制图像时增加颜色条

一、需求 plt.imshow()是matplotlib中的一个函数&#xff0c;用于显示图像。它可以传递一个二维或三维数组作为image参数&#xff0c; 并将图像数据显示为图形&#xff0c;并对图像进行不同的可视化设置。 在显示的过程中&#xff0c;我们如果需要增加一个图例显示颜色条&…

(每日持续更新)jdk api之PipedWriter基础、应用、实战

博主18年的互联网软件开发经验&#xff0c;从一名程序员小白逐步成为了一名架构师&#xff0c;我想通过平台将经验分享给大家&#xff0c;因此博主每天会在各个大牛网站点赞量超高的博客等寻找该技术栈的资料结合自己的经验&#xff0c;晚上进行用心精简、整理、总结、定稿&…

使用reduce递归获取有多层嵌套的数组中的children

常见的多层嵌套的数组&#xff0c;如下 const items [{id: 1,name: "item1",children: [{id: 11,name: "item11",children: [{id: 111, name: "item111"},{id: 112, name: "item112"}]},{id: 12,name: "item12",children:…

【问题】解决c++调用exosip是报错,无法解析的外部符号 _DnsQueryConfig@24

问题描述&#xff1a; error LNK2019: 无法解析的外部符号 _DnsQueryConfig24&#xff0c;函数 _eXosip_dnsutils_naptr 中引用了该符号 DnsQueryConfig是windowAPI&#xff0c;可查阅msdn。 #pragma comment(lib,"ws2_32.lib") #pragma comment(lib,"Dnsapi.…

Flutter学习8 - 网络编程 Http

1、配置 Http 依赖 Flutter 工具库搜索地址&#xff1a;https://pub.dev/ http最新版本查看网址&#xff1a; https://pub.dev/packages/http 在 pubspec.yaml 中引入 http 插件 dependencies:flutter:sdk: flutterhttp: ^0.13.4 # 请检查并使用最新版本命令行中输入 “ flut…

服务器后端是学习java还是php

没有绝对的"最好"语言&#xff0c;每种后端语言都有其适用的场景和特点。以下是几种常用的后端语言&#xff1a; 1. Java&#xff1a;Java是一种通用且强大的语言&#xff0c;广泛用于企业级应用和大型系统。它有很好的性能和可靠性&#xff0c;并且具有优秀的生态系…

jxls——自定义命令设置动态行高

文章目录 前言依赖引入绘制 jxls 批注的 excel 模板测试类编写自定义命令关于自动换行 前言 之前的博客中都简单说了数据的渲染和导出excel文件。包括固定的 表头结构&#xff0c;以及动态 表头和表数据等方式。 本篇博客主要说明自定义命令的方式&#xff0c;控制输出excel文…

线上问题——学习记录幂等判断失效问题分析

一、业务流程 上图是对save和saveScore两个接口的流程抽象&#xff0c;save是上传答题数据&#xff0c;saveScore则是上传答题分数&#xff0c;为保证幂等和防止并发调用&#xff0c;这两个接口都加了分布式锁&#xff08;还是两层哦&#xff09;。第一层使用的是不同的锁&…

NXP实战笔记(十一):32K3xx基于RTD-SDK在S32DS上配置LPSPI(同步、异步、DMA、主机、从机、中断、轮询)

目录 1、概述 2、RTD-SDK配置 2.1、配置目标 2.2、主、从机引脚配置 2.3、时钟配置 2.4、LPSPI配置 2.5、中断配置 2.6、DMA配置(使用DMA才会配置) 2、dma Logic Instance 2.7、RM配置(使用DMA的情况下必须配置此选项) 3、代码实现 1、概述 S32K3_低功耗LPSPI轮询…

【源码】imx6ull实现触摸屏单点实验-移植tslib和qt

一、本实验实验的器材&#xff1a; 1.正点原子imx6ull的阿尔法开发板v2.2 2.屏幕ALIENTEK 4.3 RGBLCD 二、实验已经移植好的文件&#xff1a; 仓库代码&#xff1a;https://gitee.com/wangyoujie11/atkboard_-linux_-driver.git 1.文件说明 arm-qt.tar.bz2&#xff1a;移植好的…

基于springboot的粮食仓库管理系统(源码+论文)

目录 前言 一、功能设计 二、功能实现 三、库表设计 四、论文 前言 随着我国粮食产量的逐年提升&#xff0c;传统的粮食仓库管理模式已经无法适应当前仓储管理的应用需求&#xff0c;互联网系统平台的发展以及系统化管理模式的普及&#xff0c;粮仓的管理也由传统的人工统…

Cmake的使用

第一步&#xff1a;安装Cmake 双击点开即可&#xff0c;无脑下一步。 第二步&#xff1a;编写一个简单的Cmake项目 CMakeLists.txt文件 # 设置最低的 CMake 版本要求 cmake_minimum_required(VERSION 3.10)# 设置项目名称 project(MyProject)# 添加可执行文件 add_executabl…