zoukankan      html  css  js  c++  java
  • JS淘宝浏览商品

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>相册</title> 
        <style>
            *{
                margin:0;
                padding:0;

            }
            ul{
                list-style: none;
                overflow: hidden;
            }
            ul li{
                float: left;
                 55px;
                height: 40px;
                margin-top: 10px;
                margin-left: 10px;
                border: 2px solid #fff;
            }
                ul li.active{
                    border-color: red;
                }
        </style>
    </head>

    <body>
            <img src="img/1.jpeg" id="img">
            <ul>
                <li>
                    <a href="">
                        <img src="img/1.jpeg" width="55px" height="40px" class="small">
                    </a>

                </li>
                <li>
                    <a href="">
                        <img src="img/2.jpeg" width="55px" height="40px"  class="small">
                    </a>

                </li>
                <li>
                    <a href="">
                        <img src="img/3.jpeg" width="55px" height="40px" class="small">
                    </a>

                </li>
                <li>
                    <a href="">
                        <img src="img/4.jpeg" width="55px" height="40px"  class="small">
                    </a>
              </li>
            </ul>
       <script>
        var big=document.getElementById('img');
        var small=document.getElementsByClassName('small');
        for(var i=0;i<small.length;i++)
        {
            small[i].onmouseover=function()
            {
                for(var j=0;j<small.length;j++)
                {
                    small[j].parentNode.parentNode.setAttribute('class','');
                }
                var smalls=this.getAttribute('src');
                big.setAttribute('src',smalls);

                this.parentNode.parentNode.setAttribute('class','active');
            }
        }
        </script>
    </body>

    </html>
  • 相关阅读:
    hdu 6049 Sdjpx Is Happy
    L2-012. 关于堆的判断
    L2-010. 排座位
    L2-009. 抢红包
    L2-007. 家庭房产
    L2-008. 最长对称子串
    L2-011. 玩转二叉树
    l2-006 树的遍历
    l2-005
    l1-20 帅到没朋友
  • 原文地址:https://www.cnblogs.com/lxabner/p/12340928.html
Copyright © 2011-2022 走看看