依旧只是贴在这里备份,方便以后粘贴复制,高手绕过,以免浪费时间:)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>tab页切换</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script type="text/javascript">
        function switchTab(ProTag, ProBox) {
            for (i = 1; i < 5; i++) {
                if ("tab" + i == ProTag) {
                    document.getElementById(ProTag).getElementsByTagName("a")[0].className = "on";
                } else {
                    document.getElementById("tab" + i).getElementsByTagName("a")[0].className = "";
                }
                if ("con" + i == ProBox) {
                    document.getElementById(ProBox).style.display = "";
                } else {
                    document.getElementById("con" + i).style.display = "none";
                }
            }
        }
    </script>
    <style type="text/css">
        *
        {
            padding: 0;
            margin: 0;
            line-height: 25px;
            font-size: 12px;
            list-style:none;
        }
        #tabContainer
        {
            margin: 30px;
        }
        #tabContainer li
        {
            float: left;
            width: 80px;
            margin: 0 3px;
            background: #efefef;
            text-align: center;
        }
        #tabContainer a
        {
            display: block;
        }
        #tabContainer a.on
        {
            background: pink;
        }
    </style>
</head>
<body>
    <div >
        <ul>
            <li >
                命运</a></li>
            <li >
                运势</a></li>
            <li >
                缘分</a></li>
            <li >
                人生</a></li>
        </ul>
        <div style="clear: both">
        </div>
        <div >
            命运是个神马玩意儿...
        </div>
        <div >
            霉运也是一种运气...
        </div>
        <div >
            缘份纯粹是蒙人的东西...
        </div>
        <div >
            人生就是人"生"出来之后的过程...
        </div>
    </div>
</body>
</html>

 (注:如果点击运行代码后报js错误,请在页面上右击选择编码为utf-8或刷新页面)

相关文章:

  • 2021-10-10
  • 2021-12-10
  • 2022-12-23
  • 2021-12-15
  • 2021-07-12
  • 2021-10-29
  • 2021-07-06
猜你喜欢
  • 2022-12-23
  • 2021-07-13
  • 2022-12-23
  • 2022-12-23
  • 2021-07-23
  • 2021-09-17
  • 2021-10-10
相关资源
相似解决方案