Pink老师JS学习--京东登录页面案例
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了Pink老师JS学习--京东登录页面案例,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2020字,纯文字阅读大概需要3分钟。
内容图文
感谢pink老师的课程。
这是我自己写的样式,比较丑。
这个案例是主要是练习巩固操作元素,实现了密码隐藏显示的功能。
<!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>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.sign {
width: 600px;
margin: 100px auto;
}
h1 {
font-size: 28px;
font-weight: 400;
padding-bottom: 30px;
text-align: center;
color: rgb(245, 100, 100);
}
.box,
.user {
position: relative;
color: rgb(66, 66, 66);
width: 100%;
border-bottom: 1px solid rgb(228, 228, 228);
}
.user input {
width: 100%;
height: 40px;
font-size: 20px;
border: 0;
}
#pwd {
width: 460px;
height: 46px;
font-size: 20px;
border: 0;
}
#eye {
position: absolute;
top: 11px;
right: 80px;
width: 24px;
}
.box label {
position: absolute;
right: 10px;
color: #cdcdcd;
font-size: 14px;
line-height: 46px;
}
.bt {
width: 500px;
height: 32px;
margin-left: 50px;
margin-top: 28px;
border: 0;
border-radius: 16px;
background-color: rgb(255, 60, 0);
color: white;
}
.bt:hover {
outline: none;
}
input:focus {
outline: none;
}
.rem {
position: relative;
}
.rem label,
span {
color: gray;
font-size: 14px;
}
.rem label {
position: absolute;
left: 50px;
top: 10px;
}
.rem span {
position: absolute;
top: 10px;
right: 50px;
}
</style>
</head>
<body>
<div class="sign">
<h1>会员登录</h1>
<!--输入用户名-->
<div class="user">
<input type="text">
</div>
<!--输入密码-->
<div class="box">
<input type="password" id="pwd">
<img src="隐藏.png" alt="" id="eye">
<label for="">| 忘记密码</label>
</div>
<!--登录按钮-->
<button class="bt">登录</button>
<!--信息提示-->
<div class="rem">
<label>短信验证码登录</label>
<span>手机快速注册</span>
</div>
</div>
</body>
<script>
/*获取对象*/
var eye = document.getElementById('eye');
var pwd = document.getElementById('pwd');
//注册事件
var flag = 0;
eye.onclick = function () {
if (flag = 0) { //这里不能用=号,要用==号
pwd.type = 'password';
eye.src = '隐藏.png';
flag = 1;
} else {
pwd.type = 'text';
eye.src = '显示 (1).png';
flag = 0;
}
}
</script>
</html>
内容总结
以上是互联网集市为您收集整理的Pink老师JS学习--京东登录页面案例全部内容,希望文章能够帮你解决Pink老师JS学习--京东登录页面案例所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。
来源:【匿名】