Hello teacher, please help. I made an error when selecting the version and color. When I select the second one, the default option color does not return to the original color.
Time
Time 2019-01-07 18:04:43
0
4
1582

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<link rel="stylesheet" href="static/css/detail.css" />

<link rel="stylesheet" href="static/css/layui.css" />

<link rel="stylesheet" href="static/css/style.css" />

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

<script type="text/javascript" src="static/js/layui.all.js" ></script>

<script type="text/javascript" src="static/js/jquery-3.3.1.min.js" ></script>

<script type="text/javascript" src="static/js/detail.js" ></script>

<title>红米6A立即购买—小米商城</title>

<style>

*{padding: 0;margin: 0;list-style: none;text-decoration: none;}

/*头*/

.header-lr{width:100%;height: 50px; box-shadow: 0px 10px 10px #ccc;margin-top: 10px;border-top: 2px solid #ccc;}

.header-lr-box{width: 1226px; height: 50px;margin:0 auto;}

.header-lefts li{width:70px;height: 50px;float: left;text-align: center;line-height: 50px;}

.header-lefts li a{color: #23262E;font-size: 14px;font-weight: none;}

.header-right{float: right;}

.header-right li{float: left; width: 70px;height: 50px;line-height: 50px;text-align: center;}

.header-right span{float: left;line-height: 50px; color: #aaa;font-size: 12px;}

.detail-img{width: 1226px;margin: 0 auto;}

.detail-img h6{font-size: 16px;font-weight: bold;margin: 10px auto;float: left;}

/*主要内容*/

.content-box{width: 1226px;margin: 30px auto;}

.content-box-left{width: 560px; height: 600px;float: left;}

.content-box-right{width: 600px;float: right;}

.content-box-right p{color: #aaa;margin: 10px auto;}

.content-box-map{width: 100%;height: 100px;background: /*rgba(51,51,51,0.2)*/#fafafa;margin: 20px auto;border: 1px solid #ccc;}

.content-box-map span{display: inline-block;margin-top: 10px;margin-left: 15px;}

.content-box-map i{position: relative;left: 12px;}

.content-box-money .rls{border: 1px solid #FF8200;}

.content-box-money div{width: 255px;height: 50px;text-align: center;float: left;border: 1px solid #ccc;line-height: 50px;padding: 0px 20px;}

.content-box-money span{float: right;color: #ccc;}

.content-box-money p{font-size: 18px;color: #333;margin: 15px 0px;}

.content-box-color p{font-size: 18px; color: #333; margin: 15px auto;}

.content-box-color div{width:255px ; height:50px ;float: left;padding:0px 20px;text-align: center;line-height: 50px;border:1px solid #ccc;}

.content-box-color span{display:inline-block;height: 16px;width: 16px;border-radius: 8px;margin-right: 10px;}

.content-bz-box0 p{float: left;font-size: 18px; color: #333;margin: 20px 0px;}

.content-bz-box0 a{float: right;font-size: 14px; margin: 20px 0px; color: #ff8200;}

.content-bz-box1{width: 598px;height: 150px;border: 1px solid #ccc;}

.content-bz-box1 span{float: left;width: 10px;height: 10px;line-height: 10px;border-radius: 6px;display: inline-block;margin: 60px auto;margin-left: 40px;}

.content-bz-box1 img{float: left;margin: 50px 20px;}

.content-bz-p{margin: 40px auto;}

.content-bz-p p{margin: 10px auto;}

.content-bz-p span{float: right;margin: 0px;margin-right:20px; color: #ccc;width: 50px;}

.content-bz-btn{color:rgba(0,0,0,0);border: 1px solid #ccc;}

.content-zs{width: 100%; height: 130px;background: #f9f9f9;margin-top: 30px;}

.content-zs div{margin: 0px 30px 20px;height: 50px; line-height: 30px; }

.content-zs p {float: left;}

.content-zs span{float: right;line-height: 50px;}


.content-box-color .rls{border: 1px solid #FF8200;}

.content-box-money,.content-box-color{width: 600px;}

.shop-che{width: 240px;height: 50px;text-align: center;line-height: 50px;background: #FF5722;color: #FFF; }



</style>

</head>

<body>

<div class="header">

<div class="menu">

<ul class="menu-left">

<li>

<a href="#">小米商城</a><span>|</span></li>

<li>

<a href="#">MIUI</a><span>|</span></li>

<li>

<a href="#">IOT</a><span>|</span></li>

<li>

<a href="#">云服务</a><span>|</span></li>

<li>

<a href="#">小爱分享平台</a><span>|</span></li>

<li>

<a href="#">金融</a><span>|</span></li>

<li>

<a href="#">有品</a><span>|</span></li>

<li>

<a href="#">企业服务</a><span>|</span></li>

<li>

<a href="#">SelectRegion</a>

</li>

</ul>

<div class ="menu-right">

<ul>

<li>

<a href="#">Login</a> <span>|</span></li>

<li>

<a href="#">Register</a><span> ;|</span></li>

<li>

<a href="#">My Order</a>

</li>

<li class="menu-rshop">

<a><i class="fa fa-shopping-cart">   Shopping cart(0)</i></a>

<div>There are no items in the shopping cart yet, hurry up and buy now! </div>

</li>

</ul>

</div>

</div>

</div>

<div class="contents" style="background: #F6F6F6;;">


# # <div class="content">

<div class="contentMenu">

<div class="contentMenu-imgbox">

<img src="static/images/footlogo.png" style="margin: 3px 5px;margin-right: 10px;" />

<img src="static/images/logoAD .gif" />

</div>

<!--Pull down new products N-->

<ul class="contentMenu-ul ">


<li>Xiaomi mobile phone

<div class="mi-box">

< div class="mi-boxdiv">

<div class="mi-box1">

<div class="mi-new">New Product</ div>

<div class="mi-shop">

<img src="static/images/phone/phone1.png" />

<br />

<a href="#">Xiaomi 2s</a>

<br />

<a href="#" style=" color: #FF8200;">3299 yuan</a>

</div>

</div>

<span></span>

<div class="mi-box1">

<div class="mi-new">New Products</ div>

<div class="mi-shop">

<img src="static/images/phone/phone1.png" />

<br />

<a href="#">小米2s</a>

<br />

<a href="#" style=" color: #FF8200;">3299元</a>

</div>

</div>

<span></span>

<div class="mi-box1">

<div class="mi-new">新品</div>

<div class="mi-shop">

<img src="static/images/phone/phone1.png" />

<br />

<a href="#">小米2s</a>

<br />

<a href="#" style=" color: #FF8200;">3299元</a>

</div>

</div>

<span></span>

<div class="mi-box1">

<div class="mi-new">新品</div>

<div class="mi-shop">

<img src="static/images/phone/phone1.png" />

<br />

<a href="#">小米2s</a>

<br />

<a href="#" style=" color: #FF8200;">3299元</a>

</div>

</div>

<span></span>

</div>

</div>

</li>

<li>红米

<div class="mi-box">

<div class="mi-boxdiv">

<div class="mi-box1">

<div class="mi-new">新品</div>

<div class="mi-shop">

<img src="static/images/phone/phone1.png" />

<br />

<a href="#">小米2s</a>

<br />

<a href="#" style=" color: #FF8200;">3299元</a>

</div>

</div>

<span></span>

<div class="mi-box1">

<div class="mi-new">新品</div>

<div class="mi-shop">

<img src="static/images/phone/phone1.png" />

<br />

<a href="#">小米2s</a>

<br />

<a href="#" style=" color: #FF8200;">3299元</a>

</div>

</div>

<span></span>

<div class="mi-box1">

<div class="mi-new">新品</div>

<div class="mi-shop">

<img src="static/images/phone/phone1.png" />

<br />

<a href="#">小米2s</a>

<br />

<a href="#" style=" color: #FF8200;">3299元</a>

</div>

</div>

<span></span>

<div class="mi-box1">

<div class="mi-new">新品</div>

<div class="mi-shop">

<img src="static/images/phone/phone1.png" />

<br />

<a href="#">小米2s</a>

<br />

<a href="#" style=" color: #FF8200;">3299元</a>

</div>

</div>

<span></span>

</div>

</div>

</li>

<li>电视</li>

<li>笔记本</li>

<li>盒子</li>

<li>新品</li>

<li>路由器

<div class="mi-box">

<div class="mi-boxdiv">

<div class="mi-box1">

<div class="mi-new">新品</div>

<div class="mi-shop">

<img src="static/images/phone/phone1.png" />

<br />

<a href="#">小米2s</a>

<br />

<a href="#" style=" color: #FF8200;">3299元</a>

</div>

</div>

<span></span>

<div class="mi-box1">

<div class="mi-new">新品</div>

<div class="mi-shop">

<img src="static/images/phone/phone1.png" />

<br />

<a href="#">小米2s</a>

<br />

<a href="#" style=" color: #FF8200;">3299元</a>

</div>

</div>

<span></span>

<div class="mi-box1">

<div class="mi-new">新品</div>

<div class="mi-shop">

<img src="static/images/phone/phone1.png" />

<br />

<a href="#">小米2s</a>

<br />

<a href="#" style=" color: #FF8200;">3299元</a>

</div>

</div>

<span></span>

<div class="mi-box1">

<div class="mi-new">新品</div>

<div class="mi-shop">

<img src="static/images/phone/phone1.png" />

<br />

<a href="#">小米2s</a>

<br />

<a href="#" style=" color: #FF8200;">3299元</a>

</div>

</div>

<span></span>

</div>

</div>

</li>

<li>智能硬件</li>

<li>服务</li>

<li>社区</li>

</ul>

<div class="contentMenu-form">

<form action="">

<input type="text" />

<div class="contentMenu-intxt">

<a href="#">预热618</a>

<a href="#">小米电视</a>

</div>

<div class="sousou-btn"><i class="fa fa-search"></i></div>

</form>

</div>

</div>

</div>

</div>

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

<div class="header-lr">

<div class="header-lr-box">

<div class="header-lefts">

<ul>

<li>

<a>小米8</a>

</li>

<li>

<a>小米8se</a>

</li>

</ul>

</div>

<div class="header-right">

<ul>

<li>

<a>概述</a>

</li><span>|</span>

<li>

<a>图集</a>

</li><span>|</span>

<li>

<a>参数</a>

</li><span>|</span>

<li>

<a>F码通道</a>

</li><span>|</span>

<li>

<a>用户评价</a>

</li>


</ul>

</div>

</div>

</div>

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

<!--End of header part-->

<div class="content-box">

< ;div class="content-box-left">

<div class="layui-carousel" id="test1">

<div carousel-item>

<div><img src="static/images/lun/1.jpg"></div>

<div><img src="static/ images/lun/2.jpg"></div>

<div><img src="static/images/lun/3.jpg"></div>

<div><img src="static/images/lun/4.jpg"></div>

</div>

< /div>

</div>

<div class="content-box-right">

<h1>Redmi 6A</h1> ;

                                                                                                                                 < not more ="color: #FF8200;border-bottom: 1px solid #aaa;height: 30px;">599</h2>

            <div class="content-box-map">

                                                                                                                                                                  ;<a href="#" style="color: #FF8200;">Modify</a></span><br />

              <span><a href="#" style="color: #FF8200;margin-left: 12px;">In stock</a></span>

              </div>

      

                                                                                                                                                     detail_much_left" style="margin-right: 5px;">4G 64G Full Netcom<span data-val="599">599</span></div>

          <div class ="detail_much_left">6G 64G Full Netcom<span data-val="699">699</span></div>

          </div>

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

        <div class="content-box-color">

        <p>选择颜色</p>

        <div class="content-color-left content-color-left-rls" style="margin-right: 5px;margin-bottom: 5px;"><span  style="background:#F6E6D8; "></span>金色</div>

        <div class="content-color-left"><span  style="background:#3C3F43;"></span>深灰</div>

        <div class="content-color-left" style="margin-right: 5px;"><span  style="background:#D93239;"></span>亮红</div>

        <div class="content-color-left"><span  style="background:#3871B7;"></span>亮蓝</div>

        </div>

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

        <div class="content-box-bz">

        <div class="content-bz-box0">

        <p>选择小米提供的保障服务</p>

        <a href="#">了解保障条款</a>

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

        </div>

        <div class="content-bz-box1">

        <span class="fa fa-check-circle content-bz-btn"></span>

        <img src="static/images/bz.jpg">

<div class="content-bz-p">

<p style="font-size: 18px; color: #000;">意外保障服务</p>

<p>手机意外摔落/进水/碾压等损坏</p>

<b class="fa fa-check-square content-bz-btn"></b>  我已阅读 <a href="#"> 服务条款 </a>|<a href="#"> 服务条款 </a>

<span data-val="99">99元</span>

</div>

        </div>

        </div>

; content-box-bz">

       

                                                                                                                                                                                                                                       -circle content-bz-btn"></span>

            <img src="static/images/bz.jpg">

<div class="content -bz-p">

<p style="font-size: 18px; color: #000;">Broken Screen Protection Service</p>

< p>The phone screen accidentally broke</p>

<b class="fa fa-check-square content-bz-btn"></b>  I have read < ;a href="#"> Terms of Service </a>|<a href="#"> Terms of Service </a>

< span data-val="179">179 yuan</span>

</div>

                                                                                                 

                                                                                                                                                            ;p>Xiaomi 8 6GB 64GB Black</p><span id="mi-jg">699 yuan</span></div>

            <p id="tojg " style="color:#FF6A00;font-size: 25px;margin-left: 30px;">Total : 699 yuan</p>

              </div>

                                                                                                                              ,, ,                                                     -circle-o"></i> 7 days for no reason return <i class="fa fa-check-circle-o"></i> 15 days for quality issues Goods <i class="fa fa-check-circle-o"></i> 365-day warranty</p>

          </ div>

</div>

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

<!--Description-->

<div class="detail-img">

<h6>Special Instructions</ h6>

<img src="static/images/sm.jpg" />

<h6>Official WeChat</h6>

< img src="static/images/2.jpg" />

</div>


## <!--Tail--> ;

<div class="footers">

<div class="footer">

<div class="for-li"> ;

<a href="#"><i class="fa fa-wrench"> Reservation Service</i><span>|</span> </a>

<a href="#"><i class="fa fa-rotate-right"> 7 days no questions asked</i>< span>|</span></a>

<a href="#"><i class="fa fa-refresh"> 15 days free exchange< ;/i><span>|</span></a>

<a href="#"><i class="fa fa-gift">  Free shipping for purchases over 150 yuan</i><span>|</span></a>

<a href="#"><i class="fa fa- map-marker"> More than 520 after-sales outlets</i></a>

</div>

</div>

</div>

<div class="for-li-1">

<div class="for-li-a">

<dl> ;

<dt>Help Center</dt>

<dd>

<a href="#">Account Management</a> ;

</dd>

<dd>

<a href="#">Shopping Guide</a>

</dd>

<dd>

<a href="#">Order Operations</a>

</dd>

</dl>

<dl>

<dt>Service Support</dt>

<dd>

<a href="#">After-sales policy</a>

</dd>

<dd>

< a href="#">Self-service</a>

</dd>

<dd>

<a href="#" >Related downloads</a>

</dd>

</dl>

<dl>

<dt> ;Offline stores</dt>

<dd>

<a href="#">Xiaomi Home</a>

< ;/dd>

<dd>

<a href="#">Service Outlet</a>

</dd>

<dd>

<a href="#">Authorized Experience Store</a>

</dd>

< ;/dl>

<dl>

<dt>About Xiaomi</dt>

<dd>

<a href="#">Learn about Xiaomi</a>

</dd>

<dd>

<a href="#"> ;Join Xiaomi</a>

</dd>

<dd>

<a href="#">Investor Relations< /a>

</dd>

</dl>

<dl>

<dt>Follow us</ dt>

<dd>

<a href="#">Sina Weibo</a>

</dd>

<dd>

<a href="#">Official Weibo</a>

</dd>

< dd>

<a href="#">Contact us</a>

</dd>

</dl>

<dl>

<dt>Specialized Services</dt>

<dd>

<a href="#">F code channel</a>

</dd>

<dd>

< a href="#">Gift code</a>

</dd>

<dd>

<a href="#" >Anti-counterfeiting query</a>

</dd>

</dl>

<div class="for-conten">

<p class="suorg">Feir-520-1314</p>

<p class="suorg-1">Monday to Sunday 8:00- 18:00<br />(Call charges only)</p>

<button class="btn"><span class="fa fa-commenting "></ span> Contact customer service</button>

</div>

</div>

</div>

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

<div class="for-end">

<div class="end-1" style=" margin-right: 15px;"><img src="static/images/footlogo.png" alt="" /></div>


# <div class="end-2">

<div class="endli">

<ul>

<li>Xiaomi Mall <span></span></li>

<li>MIUI<span></span></li>

<li>Mijia <span></span></li>

<li>Miliao<span></span></li>

<li> See more<span></span></li>

<li>Games<span></span></li>

<li> ;Router<span></span></li>

<li>Mifenka<span></span></li>

< li>Government and Enterprise Services<span></span></li>

<li>Xiaomi Tmall Store<span></span></li>

<li>Privacy Policy<span></span></li>

<li>Feedback<span></span></li>

<li>Select Region</li>

</ul>

</div>

<div class="endli-p">

<a href="#">©mi.com</a>

京ICP Certificate No. 110507

<a href="#">Beijing ICP No. 10046444</a>

<a href="#">Beijing Public Security Network No. 11010802020134</a>

<a href="#">Jingwangwen [2014] No. 0059-0009</a>

</a>

<br> The hotline for reporting illegal and harmful information is: 185-0130-1238. The data listed on this website, unless otherwise specified, are all from our company’s laboratory testing

< /div>

</div>

<div class="end-3">

<img src="static/images/footericon1. png" alt="" class="icon" style="margin-right: 10px;" />

<img src="static/images/footericon2.png" alt="" class= "icon" style="margin-right: 10px;" />

<img src="static/images/footericon3.png" alt="" class="icon" style="margin- right: 10px;" />

<img src="static/images/footericon4.png" alt="" class="icon" style="margin-right: 10px;" />

<img src="static/images/footericon5.png" alt="" class="icon" />

</div>

< ;div class="font">Explore black technology, Xiaomi is born for fever! </div>

</div>

</body>


##<script>

layui.use('carousel', function(){

var carousel = layui.carousel;

//Build instance

carousel.render({

elem: '#test1'

,width: '560px' //Set the container width

,height:'600px'

,arrow: 'always' //Always display the arrow

//, anim: 'updown' //Switch animation mode

});

});

</script>

<script>

//Default first version Replace class name method

$(document).ready(function(){

//Get class eq traversal (0) starting from 0 (Representing the first one) Replace the class name with .content-box-bb rls

$(".detail_much_left").eq(0).attr("class",".detail_much_left rls")

$(".content-color-left").eq(0).attr("class",".content-color-left rls")

/ /Click the selected version

$(".detail_much_left").click(function(){

$(".detail_much_left").attr("class",".detail_much_left")

$(this).attr("class",".detail_much_left rls")

})

//Click to switch colors

$(".content-color-left").click(function(){

$(".content-color-left").attr("class",".content- color-left")

$(this).attr("class",".content-color-left rls")

})


})

</script>

</html>


Time
Time

你想拥有你从未有过的东西 ,那么你必须去做你从未做过的事情。

reply all(2)
灭绝师太

There is a problem with your writing method, attr("class", "There is no dot before the class name"); this is a very small detail, please pay attention to it

  • reply Many thanks!
    Time author 2019-01-08 10:41:26
Time

solved

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template