小米商城js切换效果作业

Original 2019-01-17 17:28:49 381
abstract:login.html<!DOCTYPE html><html><head> <meta charset="utf-8"> <title>小米商城-登录</title> <link rel="stylesheet" type="text/css" href=&qu

login.html

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<title>小米商城-登录</title>

<link rel="stylesheet" type="text/css" href="css/login.css">

<link rel="stylesheet" type="text/css" href="font-awesome/css/font-awesome.min.css">

</head>

<body>

<div class="head">

<a href="index.html"><img src="img/5.png"></a>

</div>

<div class="content" style="background: url(img/login.png);">

<div class="login_cont">

<div class="login_form">

<div class="login_form_main">

<p style="color: #f60;" id="reg_account" onclick="ChangeReg('0','register_',1)">账号登录</p>

<span>|</span>

<p id="reg_scan" onclick="ChangeReg('1','register_',0)">扫码登录</p>

</div>

<div class="clear"></div>

<div class="login_form_cont" id="register_0">

<form>

<input type="text" name="username" placeholder="邮箱/手机号码/小米ID">

<input type="text" name="password" placeholder="请输入密码">

<button>登录</button>

</form>

                <h6><a href="" style="color: #f60;">手机短信登录/注册</a><span><a href="">立即注册</a>&nbsp; | &nbsp;<a href="">忘记密码?</a></span></h6>

                <div class="login_form_pic">

                <p>其他方式登录</p>

                <ul>

                <li class="pic1" style="margin-right: 35px;"><i class="fa fa-qq"></i></li>

                <li class="pic2" style="margin-right: 35px;"><i class="fa fa-weibo"></i></li>

                <li class="pic3" style="margin-right: 35px;"><i class="fa fa-twitter-square"></i></li>

                <li class="pic4"><i class="fa fa-weixin"></i></li>

                </ul>

            </div>

</div>

<div class="login_form_scan" style="display: none;" id="register_1">

<img src="img/下载.png">

<p>使用 <span style="color: #f60;">小米商场APP</span>扫一扫</p>

<p>小米手机可打开【设置】>【小米账号】扫码登录</p>

</div>

</div>

</div>

</div>

<p style="margin-top: 60px;">简体<span>|</span>繁体<span>|</span>English<span>|</span> 常见问题<span>|</span> 隐私政策</p>

<p>小米公司版权所有-京ICP备10046444-<img src="img/ghs.png"> 京公网安备11010802020134号-京ICP证110507号</p>


<script type="text/javascript">

function ChangeReg(divId, divName, Count) {

for (var i = 0; i <= Count; i++) {

document.getElementById(divName+i).style.display='none'

}

document.getElementById(divName+divId).style.display='block'

if (divId==0) {

document.getElementById('reg_account').style.color='#f60'

document.getElementById('reg_scan').style.color='#757575'

}

if (divId==1) {

document.getElementById('reg_account').style.color='#757575'

document.getElementById('reg_scan').style.color='#f60'

}

}

</script>

</body>

</html>


login.css

*{

margin: 0;

padding: 0;

}

li{

list-style: none;

}

a{

text-decoration: none;

color: #ccc;

cursor: pointer;

}

.clear{

clear: both;

}

/*头部*/

.head{

width: 1226px;

height: 100px;

margin: 0 auto;

padding-top: 20px;

padding-left: 43px;

}

/*内容*/

.content{

width: 100%;

height: 580px;

}

p{

width: 1226px;

height: 38px;

margin: 0 auto;

line-height: 38px;

text-align: center;

color: #757575;

}

span{

font-size: 17px;

margin: 0 10px;

}

.login_cont{

width: 1226px;

height: 520px;

margin: 0 auto;

}

.login_form{

width: 410px;

height: 500px;

float: right;

background: #fff;

margin: 45px 50px;

}

.login_form_main{

width: 330px;

margin: 25px auto;

}

.login_form_main p{

font-size: 23px;

text-align: center;

float: left;

color: #757575;

width: 150px;

height: 50px;

line-height: 50px;

}

.login_form_main span{

font-size: 30px;

float: left;

height: 50px;

line-height: 50px;

color: #e0e0e0;

}

.login_form_cont{

margin-top: 25px;

}

input{

border: none;

width: 330px;

height: 28px;

padding: 10px;

margin: 15px auto;

display: block;

border: 1px solid #e0e0e0;

font-size: 20px;

}

button{

border: none;

background: #f60;

width: 350px;

display: block;

height: 50px;

margin: 25px auto;

color: #fff;

}

.login_form_cont h6{

font-weight: 300;

width: 350px;

margin: 0 auto;

height: 40px;

line-height: 10px;

}

.login_form_cont span{

float: right;

color: #ccc;

}

.login_form_pic{

width: 350px;

margin: 80px auto 0;

border-top: 1px solid #e0e0e0;

position: relative;

}

.login_form_pic p{

width: 100px;

height: 30px;

line-height: 30px;

color: #ccc;

background: #fff;

position: absolute;

top: -15px;

left: 125px;

}

.login_form_pic ul{

width: 233px;

margin: 15px auto 0;

}

.login_form_pic ul li{

float: left;

height: 32px;

width: 32px;

line-height: 32px;

color: #fff;

text-align: center;

border-radius: 16px;

}

.pic1, .pic3{

background: #e6e6e6;

}

.pic2, .pic4{

background: #bfbfbf;

}

.login_form_pic ul .pic1:hover{

background: #09c;

}

.login_form_pic ul .pic2:hover{

background: red;

}

.login_form_pic ul .pic3:hover{

background: #0bf;

}

.login_form_pic ul .pic4:hover{

background: green;

}

.login_form_pic ul li i{

font-size: 17px;

}

.login_form_scan{

width: 350px;

margin: 0 auto;

text-align: center;

}

.login_form_scan img{

height: 190px;

width: 180px;

margin: 70px auto 15px;

}

.login_form_scan p{

width: 350px;

margin: 0 auto;

line-height: 20px;

height: 20px;

}


Correcting teacher:灭绝师太Correction time:2019-01-17 17:50:09
Teacher's summary:完成的不错tab切换的效果可以尝试不同种方法,继续加油!

Release Notes

Popular Entries