tab标签页的实现

我实现的比较简单,鼠标移上去和鼠标离开分别有函数,可能相对麻烦

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>tab选项卡</title>
        <style>
            a{color:black;}
            a:hover{color:blue}
            ul li{
                list-style: none;
                float:left;
                border:1px solid gray;
                width:100px;
                text-align: center;
                height:50px;
                line-height:50px;
                
            }
            ul li:hover{
                color:blue;
                cursor: pointer;
            }
        </style>
        <script>
            function fun(name){
                var a=document.getElementById(name+"_con");
                if(a.style.display=="none")
                {
                    a.style.display="block";
                }
                
            }
            function func(name){
                var a=document.getElementById(name+"_con");
                if(a.style.display=="block")
                {
                    a.style.display="none";
                }
                
            }
        </script>
    </head>
    <body>
        <div>
            <ul>
                <li id="one" οnmοuseοver="fun('one')" οnmοuseοut="func('one')">孟美岐</li>
                <li id="two" οnmοuseοver="fun('two')" οnmοuseοut="func('two')">吴宣仪</li>
                <li id="three" οnmοuseοver="fun('three')" οnmοuseοut="func('three')">exy</li>
            </ul>
        </div>
        <div style="width:305px;height:200px;border:2px solid black;margin-left:40px;margin-top:50px;text-align: center;">
            <div style="display: none;" id="one_con">
                孟美岐孟美岐孟美岐孟美岐孟美岐
            </div>
            <div style="display: none;" id="two_con">
                吴宣仪吴宣仪吴宣仪吴宣仪吴宣仪
            </div>
            <div style="display: none;" id="three_con">
                exyexyexyexyexy
            </div>
        </div>
    </body>
</html>


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值