登录界面

news/2024/9/23 6:31:58/

Re:从零开始的西柚邮箱登录界面f


first:先来看看成品效果图~~~~

then,  how to?


 

源码在此。。。

 1 <!DOCTYPE html>
 2 <html lang="en">
 3 <head>
 4   <meta charset="UTF-8">
 5   <title>西南石油大学电子邮件系统</title>
 6   <link rel="stylesheet" href="./css/style.css">
 7   <script>
 8     var checkForm = () => {
 9       let acount = document.querySelector('#acount')
10       let password = document.querySelector('#password')
11       if ('' == acount.value) {
12         alert('请填写账号')
13         return 
14       }
15       if ('' == password.value) {
16         alert('请填写密码')
17         return 
18       }
19       if ('admin' != acount.value) {
20         window.alert('不存在此账号')
21         acount.value = ''
22         password.value = ''
23         acount.focus()
24         acount.select()
25       } else if ('admin' != password.value) {
26         window.alert('密码错误')
27         password.value = ''
28         password.focus()
29       } else if ('admin' == acount.value && 'admin' == password.value){
30         window.alert('登陆成功')
31         window.location.href = 'main.htm'
32       }
33     }
34   </script>
35 </head>
36 <body>
37   <header class="head">
38     <img src="./img/login_logo.png" class="logo">
39     <span class="help">帮助</span>
40   </header>
41   <div class="content-wrapper">
42     <div class="login-wrapper">
43       <form action="#">
44         <div class="form-head">
45           <span class="form-title">账号登录</span>
46           <img src="./img/dragbar.png" class="dragbar">
47         </div>
48         <div class="form-content">
49           <span class="b-block-text">用户登录</span>
50           <input type="text" id="acount" class="info-item" placeholder="用户名" required>
51           <input type="password" id="password" class="info-item" placeholder="密码" required>
52           <div class="footer-info">
53             <span class="warning-info">学生选择@stu.swpu.edu.cn</span>
54             <a href="#" class="forget-psd">忘记密码</a>
55           </div>
56           <input class="submit" type="submit" value="登录" onclick="checkForm();return false;">
57         </div>
58       </form>
59     </div>
60     <div class="footer">西南石油大学</div>
61   </div>
62 </body>
63 </html>
login.htm
  1 * {
  2   margin: 0;
  3   padding: 0;
  4 }
  5 .head {
  6   width: 100%;
  7   height: 76px;
  8   background: #f5f5f5;
  9   background-size: cover;
 10 }
 11 .logo {
 12   position: absolute;
 13   top: 15px;
 14   left: 10px;
 15 }
 16 .help {
 17   position: absolute;
 18   top: 40px;
 19   right: 35px;
 20   font-weight: 700;
 21   font-size: 15px;
 22   color: #b3b3b3;
 23 }
 24 .content-wrapper {
 25   position: absolute;
 26   top: 92px;
 27   left: 50%;
 28   margin-left: -475px;
 29   width: 950px;
 30   height: 520px;
 31   background: url(../img/login_bg_05.jpg)
 32 }
 33 .login-wrapper {
 34   position: absolute;
 35   top: 50%;
 36   margin-top: -200px;
 37   right: 35px;
 38   width: 380px;
 39   height: 360px;
 40   background: #fff;
 41 }
 42 .login-wrapper > form {
 43   width: 300px;
 44   height: 340px;
 45   top: 15px;
 46 }
 47 .form-head {
 48   width: 360px;
 49   height: 35px;
 50   background: url(../img/c.png);
 51   font-size: 15px;
 52   color: #eee;
 53   text-align: center;
 54   line-height: 35px;
 55   opacity: .8;
 56   cursor: pointer;
 57 }
 58 .form-content {
 59   margin: 10px 0 10px 0;
 60 }
 61 .dragbar {
 62   position: absolute;
 63   right: 0;
 64   width: 20px;
 65   height: 35px;
 66   cursor: move;
 67 }
 68 .b-block-text {
 69   display: block;
 70   font-weight: 600;
 71   height: 22px;
 72   padding-top: 10px;
 73   text-indent: 30px;
 74 }
 75 .info-item {
 76   width: 300px;
 77   height: 40px;
 78   margin: 15px 0 12px 30px;
 79   padding-left: 8px;
 80   font-size: 18px;
 81   background-color: #f5f5f5;
 82 }
 83 .footer-info {
 84   margin-top: 20px;
 85 }
 86 .warning-info {
 87   color: red;
 88   margin-left: 30px;
 89 }
 90 .forget-psd {
 91   position: absolute;
 92   right: 30px;
 93   color: #c5c5c5;
 94   text-decoration: none;
 95 }
 96 .forget-psd:hover {
 97   color: #a5a5a5;
 98   text-decoration-line: underline;
 99   text-decoration-color: #c5c5c5;
100 }
101 .submit {
102   position: absolute;
103   right: 35px;
104   bottom: 25px;
105   width: 140px;
106   height: 40px;
107   background: #76f;
108   font-size: 15px;
109   color: #fff;
110   letter-spacing: 10px;
111   text-align: center;
112   cursor: pointer;
113 }
114 .footer {
115   width: 100%;
116   height: 60px;
117   background: #f1f1f1;
118   color: #bbb;
119   font-size: 14px;
120   text-align: center;
121   line-height: 60px;
122   position: absolute;
123   bottom: 0;
124 }
style.css
 1 <!DOCTYPE html>
 2 <html lang="en">
 3 
 4 <head>
 5   <meta charset="UTF-8">
 6   <title>Welcome to SWPU</title>
 7 </head>
 8 
 9 <body>
10   <div class="welcome">
11     Welcome to SWPU
12   </div>
13   <style>
14     @keyframes r {
15       0% {
16         transform: scale(0.8) translateX(-20);
17         font-size: 32px;
18       }
19 
20       12% {
21         transform: scale(0.3) translateX(-150);
22         font-size: 15px;
23       }
24 
25       24% {
26         transform: scale(-0.4) translateX(100);
27         font-size: 1px;
28       }
29 
30       46% {
31         transform: scale(-1) translateX(150);
32         font-size: 16px;
33       }
34 
35       68% {
36         transform: scale(-0.3) translateX(0);
37         font-size: 8px;
38       }
39 
40       82% {
41         transform: scale(0.4) translateX(-150);
42       }
43 
44     }
45 
46     .welcome {
47       position: absolute;
48       left: 50%;
49       top: 50%;
50       margin-left: -250px;
51       margin-top: -30px;
52       width: 500px;
53       height: 60px;
54       font-size: 35px;
55       animation: r 3s infinite;
56       animation-delay: 1s;
57       font-size: 35px;
58     }
59   </style>
60 </body>
61 
62 </html>
main.htm

 

 

总得说几句话吧


 

总体来说,没什么难度,主要是有些bug始终没搞定:

  • 由于需要在客户端进行登录验证,就需要设置onclick事件,检查,然后跳转。但是,由于没有设置表单的提交action,在这里进行本页面跳转是不成功的,至于为什么,这就是个问题了,戳这里看详情
  • 第一个很好解决,但是问题来了,拦截了事件冒泡之后,form表单中表项默认的required就不会进行检查了。。。WTF?这么好的东西就没啦?于是又多了一串检查空表项的代码

 

 

转载于:https://www.cnblogs.com/eddy-s/p/10553918.html


http://www.ppmy.cn/news/694846.html

相关文章

【调剂】东北石油大学2021年硕士研究生招生考试复试基本分数线及调剂公告

点击文末的阅读原文或者公众号界面左下角的调剂信息或者公众号回复“调剂”是计算机/软件等专业的所有调剂信息集合&#xff0c;会一直更新的。 一、复试基本分数线 1、2021年第一志愿报考东北石油大学油气储运工程专业&#xff08;082003&#xff09;复试分数线为&#xff1a;…

前端登录和注册页面的实现及验证

登录界面 文本框中在输入前要显示相应的背景图片和悬浮字&#xff0c;鼠标移上去之后就消失。在输入框内会进行检查&#xff0c;利用正则化方程判断输入是否符合要求&#xff0c;其中验证码区分大小写。点击验证码可以实现换一张验证码。点击免费注册按钮跳转到注册页面。点击…

【调剂】东北石油大学2021年硕士招生考试预调剂信息公告

点击文末的阅读原文或者公众号界面左下角的调剂信息或者公众号回复“调剂”是计算机/软件等专业的所有调剂信息集合&#xff0c;会一直更新的。 各位考生&#xff1a; 2021年硕士研究生招生考试初试成绩已经发布&#xff0c;为便于考生了解我校招生专业的生源情况、调剂形势等信…

中国石油大学胜利学院计算机二级,关于2020年3月全国计算机等级考试报名的通知...

根据教育部考试中心《关于做好2020年全国计算机等级考试工作的通知》(教试中心函〔2019〕205号)和《关于做好2020年3月全国计算机等级考试报名工作的通知》(鲁招考[2019]151号)要求&#xff0c;按照山东省教育招生考试院《山东省2020年3月全国计算机等级考试报名事项公告》&…

石油大学网考 在线作业、在线考试 自动答题辅助工具

目录 启发迭代整合流程&#xff0c;实现全程自动化效果展示 操作流程详细教程&#xff0c;保姆级别 干货分享 启发 石大 在线作业、在线考试 支持作答后查看答题卡&#xff0c;且无上限重做以最高分为准。既然能查看答题卡&#xff0c;那么肯定有答案回传到客户端&#xff08;…

cf1715 D 贪心

题意&#xff1a;https://codeforces.com/contest/1715/problem/D 思路&#xff1a;首先对于k某位为0的话&#xff0c;那么i和j这一位上一定是0&#xff0c;所以我们考虑用a数组记录确定下来的位&#xff0c;a数组0的意义代表一定为0&#xff0c;1的意义代表可能0可能1&#x…

大型语言模型作为属性化训练数据生成器

大型语言模型作为属性化训练数据生成器&#xff0c;提出一种使用多样化属性提示的数据生成方法&#xff0c;可以生成具有多样性和属性的训练数据&#xff0c;从而提高了模型的性能和数据生成的效率。 动机&#xff1a;大型语言模型(LLM)最近被用作各种自然语言处理(NLP)任务的…

iVMS-4200 Vs区别_理科与工科有什么区别?如何判断自己适合学那个?

原标题&#xff1a;理科与工科有什么区别&#xff1f;如何判断自己适合学那个&#xff1f; 理科和工科是本科专业的主体&#xff0c;在报考中&#xff0c;大家总是习惯地把理科和工科合在一起&#xff0c;俗称为“理工”。两者之间虽然有联系但却是截然不同的两大学科&#xff…