• 手机版

    扫码体验手机版

  • 微信公众号

    扫码关注公众号

国内首家协议开发

软芯音视解码保护平台

在线
客服

发布
需求

在线
聊天

天盟
APP

天盟APP下载

关注
微信

微信扫一扫访问
顶部

想要实现点击右下角数字显示相应图片,请问哪里有问题

*{margin: 0;padding: 0;}a{text-decoration: none;}ul{list-style: none;}.box{position: relative;border: 1px solid blue;width: 500px;height: 300px;}.box .lef{position: absolute;top: 0;left: 0;width: 20px;height: 100px;border: 1px solid blue;}.box .lef>li{width: 20px;height: 20px;text-align: center;line-height: 20px;background: #000;color: #fff;margin-bottom: 5px;}.box .rig{position: absolute;top: 0;left: 20px;width: 480px;height: 300px;border: 1px solid red;}.box .rig .list .img li{display: none;position: absolute;top: 0;left: 0;}.box .rig .list .img li.open{display: block;}.box .rig .tab{position: absolute;bottom: 0;right: 0;width: 100px;height: 20px;border: 1px solid red;}.box .rig .tab li{width: 20px;height: 20px;margin-right: 5px;text-align: center;line-height: 20px;background: #000;color: #fff;float: left;cursor: pointer;}

  • 1
  • 2
  • 3
  • 4










    • 1
    • 2
    • 3
    • 4









    • 1
    • 2
    • 3
    • 4









    • 1
    • 2
    • 3
    • 4









    • 1
    • 2
    • 3
    • 4

</ul>
<script>var oTab = document.getElementsByClassName('tab')[0].getElementsByTagName('li'),oImg = document.getElementsByClassName("img")[0].getElementsByTagName("li"),length = oTab.length;for(var i=0; i

免责声明:本内容仅代表回答会员见解不代表天盟观点,请谨慎对待。

版权声明:作者保留权利,不代表天盟立场。

使用道具 举报

全部参与3

你可以找一些關於“JS中for循环变量作用域”的資料看一下

使用道具 举报

而且你也不用寫那麼多個








</ul>

1

2

3

4

</ul>
寫一個就可以了,然後當點擊數字顯示相應圖片,其他圖片消失就行

使用道具 举报


       
  • 1
       
  • 2
       
  • 3
       
  • 4
      



  
  
   

          
  • 1
          
  • 2
          
  • 3
          
  • 4
       

   

            
  • 1
            
  • 2
            
  • 3
            
  • 4
       

  



<script>


var oTab = document.getElementsByClassName('tab')[0].getElementsByTagName('li'),
oImg = document.getElementsByClassName("img")[0].getElementsByTagName("li"),
length = oTab.length;



for(var i=0; i

使用道具 举报

发新帖

发布任务需求已有1031167位用户正在使用天盟网服务

发布分类: *
任务预算: *
需求内容: *
手机号码: *
任务商家报价为
  • 预算价 :
  • 成交价 :
  • 完工期 :
  • 质保期 :

* 最终任务项目以服务商报价、双方协商为准!