1. <style>
    2. *{margin: 0;padding:0}
    3. .small-icons img{
    4. width: 116px;
    5. height: 116px;
    6. }
    7. .current{
    8. border:2px solid red;
    9. }
    10. .content img{
    11. height: 500px;
    12. width: 600px;
    13. border: 2px solid red;
    14. }
    15. </style>
     <div class="small-icons">
            <img src="images/01.jpg" alt="" class="current">
            <img src="images/02.jpg" alt="">
            <img src="images/03.jpg" alt="">
            <img src="images/04.jpg" alt="">
            <img src="images/05.jpg" alt="">
        </div>
        <div class="content">
            <img src="images/01.jpg" alt="" class="current">
        </div>
        <script>
           var icons=document.querySelectorAll(".small-icons>img");
           var show=document.querySelectorAll(".content>img")[0];
            for(let i=0;i<icons.length;i++){
                icons[i].index=i;
                icons[i].onclick=function(){
                  for(let i=0;i<icons.length;i++){
                      icons[i].classList.remove("current")   //其余的都移出current
                   }
                  this.classList.add("current")   //当前增加一个current
                  var index=this.index;   //将当前下标给index
                  show.src=`images/0${index+1}.jpg`   //图片从01开始,index从0开始,所以index要+1
                }
            }
        </script>