news 2026/4/18 8:27:05

EmailLogin

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
EmailLogin

EmailLogin.html

<!DOCTYPE html> <html lang="zh-cn"> <head> <meta charset="utf-8" /> <title>邮箱登录</title> <!--<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />--> <meta name="viewport" content="initial-scale=1.0, width=device-width"> <link rel="stylesheet" type="text/css" href="../css/login.css" /> <link href="../images/bitnami_favicon-16x16.png" rel="icon" sizes="16x16" type="image/png"> <!--<link rel="preload" href="../Font/simkai.ttf" as="font" crossorigin="anonymous">--> <link rel="preload" href="../Font/AaBanRuoKaiShu-2.ttf" as="font" type="font/ttf" crossorigin> <script type="text/javascript" src="../js/utility.js" charset="utf-8"></script> <script type="text/javascript" src="../js/Algorithm/sha1.js" charset="utf-8"></script> <script type="text/javascript" src="../js/login.js" charset="utf-8"></script> <script type="text/javascript" src="../js/email_valicode.js" charset="utf-8"></script> <script src="../js/loadFont.js"></script> </head> <body> <div id="container"> <div id="ng"> <h3 id="ng-h">邮箱登录</h3> <app-avater-heder id="ng-pic"><img id="pic" alt="" src="../images/sign-in-avatar.svg" /></app-avater-heder> </div> <div id="mainfun"> <form id="bg" onsubmit="subcontrol()" target="submitaccount"> <div id="txtdiv1"> <input id="emalname" name="email" type="email" class="txt" autocomplete="on" placeholder="邮箱" onblur="CheckEmailForValicode()" onfocus="CheckEmailForValicode()" tabindex="1"/> </div> <div id="txtdiv2"> <input id="lgpswd" type="password" class="txt" maxlength="4" autocomplete="off" placeholder="验证码" tabindex="2"> <div class="send_btn"><a id="a_send_btn" href="javascript:sendvalicode(max_wait)" class="send_btn_link">获取验证码</a></div> </div> <div id="lgdiv"> <button id="lgbtn" type="button" onclick="loginsubmit()" onkeyup="loginsubmit()">登录/注册</button> <iframe title="back" name="submitaccount" style="display: none;"></iframe> </div> <div id="hint">&nbsp;</div> </form> </div> </div> <footer id="_footer" > <a target="_self" href="../">自转首页</a>&nbsp;&nbsp; <a target="_blank" href="../">新开首页</a> </footer> </body> </html>

login.js

// JavaScript Document // window.onload = function(){ if(localStorage.getItem('href_beforelogin')==null) { localStorage.setItem('href_beforelogin','../webpage/Home.html.php'); } sessionStorage.setItem('subCtrl',true); //聚焦,只有聚焦了select()才有效。 $('emalname').focus(); //设置按钮的快捷键 $('emalname').accessKey=13; //回车键的键值 $('lgpswd').accessKey=13; //回车键的键值 //form的tableindex $('emalname').tabIndex=1; $('lgpswd').tabIndex=2; $('lgbtn').tabIndex=3; //邮箱名输入框回车按钮事件 $('emalname').onkeydown = function () { if (event.keyCode == 13) { event.preventDefault(); $('lgpswd').select(); } } //验证码框回车按钮事件 $('lgpswd').onkeydown = function () { if (event.keyCode == 13) { event.preventDefault(); loginsubmit(); } } } function subcontrol() { return (sessionStorage.getItem('subCtrl')==true)?true:false; } var lgwait=3; var id_interval=0; function loginsubmit() { $('hint').innerText=""; if($('emalname').value==null || $('emalname').value==''){ $('hint').innerText="用户名为空!"; sessionStorage.setItem('subCtrl',false); } else sessionStorage.setItem('subCtrl',true); if($('lgpswd').value==null || $('lgpswd').value=='') { $('hint').innerText+="密码为空!"; sessionStorage.setItem('subCtrl',false); } else { sessionStorage.setItem('subCtrl',true); } if(sessionStorage.getItem('subCtrl')=='true') { try { var hintmsg=new XMLHttpRequest(); var user_name=$('emalname').value; var user_pswd = hex_sha1($('lgpswd').value);//引用sha1.js localStorage.setItem('useremail',user_name); var account=new Object(); account={"user_name":user_name, "user_pswd":user_pswd}; var accountmsg=JSON.stringify(account); var responseMsg; if (hintmsg!=null) { hintmsg.open("POST","../php/backwork/login_chk.php",true); hintmsg.setRequestHeader("Content-Type", "application/json;charset=utf-8"); hintmsg.send(accountmsg); hintmsg.onreadystatechange = function () { if(hintmsg.readyState==4 && this.status==200) { responseMsg=''; if(hintmsg.responseText!=''){ responseMsg=JSON.parse(hintmsg.responseText); sessionStorage.setItem('transportbuf',hintmsg.responseText); } //console.log(responseMsg); if(responseMsg.info!='' || responseMsg.info==null) $('hint').innerText+=responseMsg.info; else $('hint').innerText+='no message'; if(responseMsg.code==1302 || responseMsg.code==1103){ localStorage.setItem("login_info",JSON.stringify(responseMsg.data)); //判断后再处理 $('hint').innerText=responseMsg.info+lgwait+"秒后跳转。"; id_interval=setInterval(selfgoto,1000,localStorage.getItem("href_beforelogin")); } } } } } catch(e) { console.log(e); } } } function selfgoto(url) { --lgwait; $('hint').innerText=lgwait+"秒后跳转。" if(lgwait<=0) { clearInterval(id_interval); if(url==''||url==null) self.location='../webpage/Home.html.php'; else self.location=url; } //console.log(lgwait); //console.log("id:",id_interval); }

logout.js

// JavaScript Document function logout() { if(JSON.parse(localStorage.getItem("login_info"))!=null) { localStorage.removeItem("login_info"); } if(localStorage.getItem(href_beforelogin)!='') { self.location=localStorage.getItem(href_beforelogin); } } function loginshow() { if(JSON.parse(localStorage.getItem("login_info"))!=null) { let now=Math.floor(new Date().getTime()/1000); let expireon=JSON.parse(localStorage.getItem("login_info")).expireon; //console.log(expireon,now); if(now < expireon) { //show document.getElementById("logincontent").style.display="contents"; } //定时隐藏 setTimeout(function(){ document.getElementById("logincontent").style.display="none"; },(expireon-now)*1000); } else { //hidden document.getElementById("logincontent").style.display="none"; } }

email_valicode.js

// JavaScript Document function logout() { if(JSON.parse(localStorage.getItem("login_info"))!=null) { localStorage.removeItem("login_info"); } if(localStorage.getItem(href_beforelogin)!='') { self.location=localStorage.getItem(href_beforelogin); } } function loginshow() { if(JSON.parse(localStorage.getItem("login_info"))!=null) { let now=Math.floor(new Date().getTime()/1000); let expireon=JSON.parse(localStorage.getItem("login_info")).expireon; //console.log(expireon,now); if(now < expireon) { //show document.getElementById("logincontent").style.display="contents"; } //定时隐藏 setTimeout(function(){ document.getElementById("logincontent").style.display="none"; },(expireon-now)*1000); } else { //hidden document.getElementById("logincontent").style.display="none"; } }
版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/4/15 5:31:56

计算机SSM毕设实战-基于SSM的手机商城基于VUE+SSM手机商城销售系统【完整源码+LW+部署说明+演示视频,全bao一条龙等】

博主介绍&#xff1a;✌️码农一枚 &#xff0c;专注于大学生项目实战开发、讲解和毕业&#x1f6a2;文撰写修改等。全栈领域优质创作者&#xff0c;博客之星、掘金/华为云/阿里云/InfoQ等平台优质作者、专注于Java、小程序技术领域和毕业项目实战 ✌️技术范围&#xff1a;&am…

作者头像 李华
网站建设 2026/4/18 6:33:10

‍爱尔兰总理马丁达沃斯观点-万祥军| 世界经济论坛·国际科学院组织

‍爱尔兰总理马丁达沃斯观点-万祥军| 世界经济论坛国际科学院组织爱尔兰总理马丁在达沃斯世界经济论坛2026年年会上的发言引发了国际社会的深刻思考。国际科学院组织代表兼国际科学院委员会执委万祥军解读表明&#xff1a;“这位以务实著称的欧洲领导人站在阿尔卑斯山麓的演讲台…

作者头像 李华
网站建设 2026/3/14 11:59:17

Linux命令-logout(安全结束当前登录会话)

&#x1f9ed;说明 logout 是 Linux 系统中用于安全结束当前登录会话的命令。下面这张表格汇总了它的核心用法和特点。特性说明命令功能退出当前登录的 Shell&#xff08;登录会话&#xff09;适用场景主要用于通过 SSH 远程连接、虚拟终端&#xff08;tty&#xff09;等方式登…

作者头像 李华
网站建设 2026/4/12 23:07:29

开题报告被批 “逻辑悬浮”?虎贲等考 AI 让研究从 “空想” 到 “落地”,导师直接点头

“改了 6 版的开题报告&#xff0c;还被导师说‘研究缺口不明确’”“技术路线画得像迷宫&#xff0c;评审一眼看穿‘不可行’”“文献引用格式错了 7 处&#xff0c;学术严谨性不达标”—— 开题季的焦虑&#xff0c;本质是 “学术逻辑没找对”。多数同学陷入 “盲目搭框架、文…

作者头像 李华
网站建设 2026/4/17 12:36:32

AI大模型:python美食推荐系统 数据分析系统 可视化 Django框架 食品分析 菜谱分析 协同过滤推荐算法 毕业设计(源码+文档)✅

博主介绍&#xff1a;✌全网粉丝10W&#xff0c;前互联网大厂软件研发、集结硕博英豪成立软件开发工作室&#xff0c;专注于计算机相关专业项目实战6年之久&#xff0c;累计开发项目作品上万套。凭借丰富的经验与专业实力&#xff0c;已帮助成千上万的学生顺利毕业&#xff0c;…

作者头像 李华
网站建设 2026/4/11 22:40:35

计网——物理层

提示&#xff1a;文章写完后&#xff0c;目录可以自动生成&#xff0c;如何生成可参考右边的帮助文档 文章目录 前言一、通信基础(一) 基本概念(二) 奈奎斯特定理&#xff08;奈氏准则&#xff09;与香农定理1. 失真 (Distortion)2. 奈奎斯特定理&#xff08;奈氏准则&#xff…

作者头像 李华