<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>选项卡</title>
    <style type="text/css">
     /* CSS样式制作 */  
     *{margin:0;padding:0;font:normal 12px "微软雅黑";color:#000000;}
     ul{list-style-type: none;}
     a{text-decoration: none;}
     #tab-list{width: 275px;height:190px;margin: 20px auto;}
     #ul1{border-bottom: 2px solid #8B4513;height: 32px;}
     #ul1 li{display: inline-block;width: 60px;line-height: 30px;text-align: center;border: 1px solid #999;border-bottom: none;margin-left: 5px;}
     #ul1 li:hover{cursor: pointer;}
     #ul1 li.active{border-top:2px solid #8B4513;border-bottom:2px solid #FFFFFF;}
     #tab-list div{border: 1px solid #7396B8;border-top: none;}
     #tab-list div li{height: 30px;line-height: 30px;text-indent: 8px;}
     .show{display: block;}.hide{display: none;}
    </style>
</head>
<body>
<!-- HTML页面布局 -->
<div >独家别墅280万 苏州桥2居优惠价248万</a></li>
        </ul>
    </div>
</div>
</body>

  <script type="text/javascript">
         
    window.onload = function() {
        var oUl1 = document.getElementById("ul1");
        var aLi = oUl1.getElementsByTagName("li");
        var oDiv = document.getElementById("tab-list");
        var aDiv = oDiv.getElementsByTagName("div");
        for(var i = 0; i < aLi.length; i++) {
            aLi[i].index = i;
            aLi[i].onmouseover = function() {
                for(var i = 0; i < aLi.length; i++) {
                    aLi[i].className = "";
                }
                this.className = "active";
                for(var j = 0; j < aDiv.length; j++) {
                    aDiv[j].className = "hide";
                }
                aDiv[this.index].className = "show";
            }        
        }
    }
    </script>
</html>

相关文章:

  • 2021-10-19
  • 2022-12-23
  • 2021-05-03
  • 2022-12-23
  • 2022-12-23
  • 2021-05-14
  • 2021-05-01
猜你喜欢
  • 2021-12-20
  • 2022-12-23
  • 2021-05-17
  • 2021-06-05
  • 2022-12-23
  • 2021-07-21
相关资源
相似解决方案