首页 > 其他 > 详细

点击同类选项出现文字

时间:2014-05-07 11:12:40      阅读:355      评论:0      收藏:0      [点我收藏+]

今天写一个订单页面时,要求:在多个地址中选择一个时,被选择的地址前面要有文字出现。

完成这个问题后,自己写一个简单的。

bubuko.com,布布扣
<html>
    <head>
        <title>wiming</title>
        <meta http-equiv="content-type" content="text/html;charset=utf-8">
        <link href="../css/buy_now.css" rel="stylesheet" type="text/css">
        <script src="http://cdn.bootcss.com/jquery/2.1.0/jquery.min.js"></script> 
        <style type="text/css">
            p{ 
                text-align:center;
            }
            .fruit-list{
                margin:0 auto;
                margin-top:20px;
                text-align:center;
             }
             .fruit-list:hover{ 
                 background-color:#FF5511;
             }
             .mylove-list{
                 display:none;
             }
             .on .mylove-list{ 
                 display:inline;
             }
        </style>
        <script type="text/javascript">
             $(function(){ 
                     $(".fruit-list").click(function(){
                         $(".fruit-list").removeClass("on")
                         $(this).addClass("on")
                         })
                     })
        </script>
    </head>
    <body>
        <p>点你喜欢的水果?</p>
        <div class="fruit-list">
            <span class="mylove-list">我喜欢
            </span>
            <label>苹果
            </label>
        </div>
        <div class="fruit-list">
            <span class="mylove-list">我喜欢
            </span>
            <label>西瓜
            </label>
        </div>
        <div class="fruit-list">
            <span class="mylove-list">我喜欢
            </span>
            <label>芒果
            </label>
        </div>
        <div class="fruit-list">
            <span class="mylove-list">我喜欢
            </span>
            <label>雪梨
            </label>
        </div>
    </body>
</html>
bubuko.com,布布扣

 

点击同类选项出现文字,布布扣,bubuko.com

点击同类选项出现文字

原文:http://www.cnblogs.com/wiming/p/3712891.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!