JS+CSS实现的不规则TAB选项卡效果

时间:2024-03-11 21:04:46

代码简介:

我觉得挺新鲜,一改选项卡中规中矩的风格,这款采用菱形,觉得不错,不规则TAB选项卡,奉献给大家。

代码内容:

<html>
<head>
<title>JS+CSS实现的不规则TAB选项卡效果_网页代码站(www.webdm.cn)</title>
<style type="text/css">
<!--
body,td{font-size: 12px;}
.tab{margin-top:100px}
#TabTab03Con1{width:346px;height:100px;line-height:100px;border-left:#757575 1px solid;border-bottom:#757575 1px solid;border-right:#757575 1px solid;}
#TabTab03Con2{width:346px;height:100px;line-height:100px;border-left:#757575 1px solid;border-bottom:#757575 1px solid;border-right:#757575 1px solid;}
#TabTab03Con3{width:346px;height:100px;line-height:100px;border-left:#757575 1px solid;border-bottom:#757575 1px solid;border-right:#757575 1px solid;}
.xixi1{width:346px;height:27px;line-height:27px;background-image:url(http://www.webdm.cn/images/20101210/3/tab01.jpg);cursor:pointer;}
.xixi2{width:346px;height:27px;line-height:27px;background-image:url(http://www.webdm.cn/images/20101210/3/tab02.jpg);cursor:pointer;}
.xixi3{width:346px;height:27px;line-height:27px;background-image:url(http://www.webdm.cn/images/20101210/3/tab03.jpg);cursor:pointer;}
.tab1{width:115px;height:27px;line-height:27px;float:left;text-align:center;cursor:pointer;}
.tab2{width:115px;height:27px;line-height:27px;float:left;text-align:center;cursor:pointer;color:#FFFFFF;}
.tab3{width:115px;height:27px;line-height:27px;float:left;text-align:center;cursor:pointer;color:#FFFFFF;}
-->
</style>
</head>
<body style="text-align:center">
<script type=text/javascript>
    function setTab03Syn(i) {
        selectTab03Syn(i);
    }

    function selectTab03Syn(i) {
        switch (i) {
            case 1:
                document.getElementById("TabTab03Con1").style.display = "block";
                document.getElementById("TabTab03Con2").style.display = "none";
                document.getElementById("TabTab03Con3").style.display = "none";
                document.getElementById("font1").style.color = "#000000";
                document.getElementById("font2").style.color = "#ffffff";
                document.getElementById("font3").style.color = "#ffffff";
                break;
            case 2:
                document.getElementById("TabTab03Con1").style.display = "none";
                document.getElementById("TabTab03Con2").style.display = "block";
                document.getElementById("TabTab03Con3").style.display = "none";
                document.getElementById("font1").style.color = "#ffffff";
                document.getElementById("font2").style.color = "#000000";
                document.getElementById("font3").style.color = "#ffffff";
                break;
            case 3:
                document.getElementById("TabTab03Con1").style.display = "none";
                document.getElementById("TabTab03Con2").style.display = "none";
                document.getElementById("TabTab03Con3").style.display = "block";
                document.getElementById("font1").style.color = "#ffffff";
                document.getElementById("font2").style.color = "#ffffff";
                document.getElementById("font3").style.color = "#000000";
                break;
        }
    }

</script>

<div class="tab">
	<div id="bg" class="xixi1">
		<div id="font1" class="tab1" onMouseOver="setTab03Syn(1);document.getElementById(\'bg\').className=\'xixi1\'">查询广告企业</div>
		<div id="font2" class="tab2" onMouseOver="setTab03Syn(2);document.getElementById(\'bg\').className=\'xixi2\'">查询媒体刊例</div>
		<div id="font3" class="tab3" onMouseOver="setTab03Syn(3);document.getElementById(\'bg\').className=\'xixi3\'">查询供求商情</div>
	</div>
    <div id=TabTab03Con1>不规则TAB选项卡效果</div>
	<div id=TabTab03Con2 style="display:none">内容2</div>
    <div id=TabTab03Con3 style="display:none">内容3</div>
</div>
<br />
<p><a href="http://www.webdm.cn">网页代码站</a> - 最专业的网页代码下载网站 - 致力为中国站长提供有质量的网页代码!</p>
</body>
</html>
代码来自:http://www.webdm.cn/webcode/2964efc1-dceb-4460-a9f0-96de0016d1f6.html