本帖最后由 sxfd321 于 2010-11-27 15:24:33 编辑

解决方案 »

  1.   

    好像就是一个tab标签吧,刚好写了个,你自己改改吧,建议你使用循环。<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
     <head>
      <title> New Document </title>
      <meta name="Generator" content="EditPlus">
      <meta name="Author" content="">
      <meta name="Keywords" content="">
      <meta name="Description" content="">
      <style>
    ul,li{padding:0;margin:0;list-style:none;}
    ul#remindSetTab li{width:120px;border:1px #ccc solid;border-bottom:1px solid #ccc;float:left;margin-right:2px;display:block;height:24px;line-height:24px;vertical-align:middle;text-align:center;color:#666;position:relative;z-index:2;background:#EEE;cursor:pointar}
    #DataSet{border:1px solid #CCC;width:100%;height:300px;position:relative;z-index:1;top:-1px}
    ul#remindSetTab li:first-child{margin-left:10px;border-bottom:1px solid #FFF;background:#FFF}
    #DataSet{clear:both}
      </style>
      <script>
      function MenuClick(obj,sValue){
    var tag = document.getElementsByTagName("li")
    var data = document.getElementById("DataSet")
    for (var i=0;i<tag.length;i++ )
    {
    tag[i].style.background="#EEE"
    tag[i].style.borderBottom="1px solid #CCC"
    obj.style.background = "#FFF"
    obj.style.borderBottom  = "1px solid #FFF" }
    data.innerHTML = sValue
      }
      </script>
     </head> <body>
    <ul id="remindSetTab">
    <li onclick="MenuClick(this,'新闻1')">新闻1</li>
    <li onclick="MenuClick(this,'新闻2')">新闻2</li>
    <li onclick="MenuClick(this,'新闻3')">新闻3</li>
    <li onclick="MenuClick(this,'新闻4')">新闻4</li>
    </ul>
    <div id="DataSet">新闻1</div>
     </body>
    </html>
      

  2.   

    为什么用我的ID theforever写这样的代码?? 来搞我?
      

  3.   

    你看下我这个博客,就是讲解决这个用途的
    http://blog.csdn.net/theforever/archive/2010/08/23/5832244.aspx
      

  4.   

    难道下面的是楼主想要的。
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" >
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html;charset=gb2312" />
    <title>520</title>
    <style type="text/css">
    <!--
    body{ padding:0;font:12px "宋体";  }
    textarea{
        height: 96px;
        width: 100px;
        margin-top: 0px;
        top: 0px;
    }
    /*选项卡1*/
    #lib_Tab1{
        width:200px;
        padding:0px;
        float: left;
        margin-top: 0px;
        margin-right: 0px;
        margin-bottom: 15px;
        margin-left: 0px;
    }
    /*选项卡2*/
    #lib_Tab2{
        width:200px;
        padding:0px;
        margin-bottom:0px;
        float: left;
        margin-top: 0px;
        margin-right: 0px;
        margin-left: 20px;
    }
    #lib_Tab3{
        width:230px;
        padding:0px;
        margin-bottom:0px;
        float: left;
        margin-top: 0px;
        margin-right: 0px;
        margin-left: 15px;
    }
    .q0{
        height: 68px;
        width: 250px;
        position: absolute;
        top: 204px;
        left: 150px;
    }
    .q1{
        height: 16px;
        width: 30px;
        border: thin solid #3399FF;
        float: left;
    }
    .q2{
        height: 16px;
        width: 30px;
        border: thin solid #3399FF;
        float: left;
        margin-left: 10px;
    }
    .q3{
        height: 16px;
        width: 40px;
        border: thin solid #3399FF;
        float: left;
        clear: right;
        margin-left: 10px;
    }
    .q4{
        height: 16px;
        width: 40px;
        border: thin solid #3399FF;
        float: left;
        clear: right;
        margin-left: 10px;
    }
    /*菜单class*/
    .lib_tabborder{
        border:1px solid #95C9E1;
    }
    .lib_Menubox {height:28px;line-height:28px;position:relative;}.lib_Menubox ul{margin:0px;padding:0px;list-style:none; position:absolute; top:3px; left:0; margin-left:10px; height:25px;text-align:center;}
    .lib_Menubox li{
        float:left;
        display:block;
        cursor:pointer;
        width:40px;
        color:#949694;
        font-weight:bold;
        margin-right:2px;
        height:25px;
        line-height:25px;
        background-color:#E4F2FD
    }
    .lib_Menubox li.hover{
        padding:0px;
        background:#fff;
        width:40px;
        border-left:1px solid #95C9E1;
        border-top:1px solid #95C9E1;
        border-right:1px solid #95C9E1;
        color:#739242;
        height:25px;
        line-height:25px;
    }
    .lib_Contentbox{
        clear:both;
        margin-top:0px;
        border-top:none;
        height:95px;
        text-align:center;
        padding-top:8px;
    }
    .lib_Contentbox div{
        top: -7px;
        margin-top: 0px;
        position: relative;
    }
    -->
    </style></head>
    <body>
    <div id="lib_Tab1">
    <div class="lib_Menubox lib_tabborder">
    <ul>
       <li id="one1" onclick="setTab('one',1,3)" class="hover">新闻1</li>
       <li id="one2" onclick="setTab('one',2,3)" >新闻2</li>
       <li id="one3" onclick="setTab('one',3,3)" >新闻3</li>
    </ul>
     </div>
     <div class="lib_Contentbox lib_tabborder">  
    <div id="con_one_1" ><textarea id="one1d" onmouseover="this.focus()" onfocus="this.select()"></textarea> 新闻1a1</div>
    <div id="con_one_2" style="display:none"><textarea id="one2d" onmouseover="this.focus()" onfocus="this.select()">234656</textarea>新闻2a2</div>
    <div id="con_one_3" style="display:none"><textarea id="one3d" onmouseover="this.focus()" onfocus="this.select()"></textarea>新闻3a3</div>
     </div>
    </div>
    <div id="lib_Tab2">
    <div class="lib_Menubox lib_tabborder">
    <ul>
       <li id="two1" onclick="setTab('two',1,4)" class="hover">新闻4</li>
       <li id="two2" onclick="setTab('two',2,4)" >新闻5</li>
       <li id="two3" onclick="setTab('two',3,4)" >新闻6</li>
       <li id="two4" onclick="setTab('two',4,4)" >新闻7</li>
    </ul>
    </div>
     <div class="lib_Contentbox lib_tabborder">  
       <div id="con_two_1" ><textarea rows="4" id="two1d" onmouseover="this.focus()" onfocus="this.select()"></textarea>
       新闻4b1</div>
       <div id="con_two_2" style="display:none"><textarea id="two2d" onmouseover="this.focus()" onfocus="this.select()"></textarea> 新闻5b2</div>
       <div id="con_two_3" style="display:none"><textarea id="two3d" onmouseover="this.focus()" onfocus="this.select()">587346</textarea> 新闻6b3</div>
       <div id="con_two_4" style="display:none"><textarea id="two4d" onmouseover="this.focus()" onfocus="this.select()"></textarea> 新闻7b4</div>
     </div>
    </div>
    <div id="lib_Tab3">
    <div class="lib_Menubox lib_tabborder">
    <ul>
       <li id="three1" onclick="setTab('three',1,5)" class="hover"> 新闻8</li>
       <li id="three2" onclick="setTab('three',2,5)" > 新闻9</li>
       <li id="three3" onclick="setTab('three',3,5)" > 新闻10</li>
       <li id="three4" onclick="setTab('three',4,5)" > 新闻11</li>
       <li id="three5" onclick="setTab('three',5,5)" > 新闻12</li>
    </ul>
    </div>
     <div class="lib_Contentbox lib_tabborder">  
       <div id="con_three_1" ><textarea id="three1d" onmouseover="this.focus()" onfocus="this.select()"></textarea> 
       新闻8a1</div>
       <div id="con_three_2" style="display:none"><textarea id="three2d" onmouseover="this.focus()" onfocus="this.select()">dsd</textarea> 新闻9a2</div>
       <div id="con_three_3" style="display:none"><textarea id="three3d" onmouseover="this.focus()" onfocus="this.select()"></textarea> 新闻10a3</div>
       <div id="con_three_4" style="display:none"><textarea id="three4d" onmouseover="this.focus()" onfocus="this.select()">fvhnd</textarea> 新闻11a4</div>
       <div id="con_three_5" style="display:none"><textarea id="three5d" onmouseover="this.focus()" onfocus="this.select()"></textarea> 新闻12a4</div>
     </div>
    </div>
    <div class="q0">
      <div class="q1"><a href="#one2d" onclick="theforever('one',2,3)">新闻2</div>
      <div class="q2"><a href="#two3d" onclick="theforever('two',3,4)">新闻6</div>
      <div class="q3"><a href="#three2d" onclick="theforever('three',2,5)">新闻9</div>
      <div class="q4"><a href="#three4d" onclick="theforever('three',4,5)">新闻11</div>
    </div>
    </body>
    <script>
    function setTab(name,cursel,n){
     for(i=1;i<=n;i++){
      var menu=document.getElementById(name+i);
      var con=document.getElementById("con_"+name+"_"+i);
      menu.className=i==cursel?"hover":"";
      con.style.display=i==cursel?"block":"none";
      }
      if(i=cursel)
      document.getElementById(name+i+"d").focus();
    }
    function theforever(name,cursel,n){
        setTab(name,cursel,n);
    var con=document.getElementById("con_"+name+"_"+cursel);
    con.style.backgroundColor='#99CC99';
    }
    /*
    function theforever1()
    {
    document.getElementById("con_one_2").style.display = "block";  
    document.getElementById("con_one_1").style.display = "none";
    document.getElementById("con_one_3").style.display = "none";
    document.getElementById("one2").className = "hover";
    document.getElementById("one1").className = "";
    document.getElementById("one3").className = "";
    document.getElementById("one2d").focus();
    document.getElementById('one2d').parentNode.style.backgroundColor='#99CC99';  

    function theforever2()
    {
    document.getElementById("con_two_3").style.display = "block";
    document.getElementById("con_two_1").style.display = "none";
    document.getElementById("con_two_2").style.display = "none";
    document.getElementById("con_two_4").style.display = "none";
    document.getElementById("two3").className = "hover";
    document.getElementById("two1").className = "";
    document.getElementById("two2").className = "";
    document.getElementById("two4").className = "";
    document.getElementById("two3d").focus();
    document.getElementById('two3d').parentNode.style.backgroundColor='#99CC99';  
    }
    function theforever3()
    {
    document.getElementById("con_three_2").style.display = "block";
    document.getElementById("con_three_1").style.display = "none";
    document.getElementById("con_three_3").style.display = "none";
    document.getElementById("con_three_4").style.display = "none";
    document.getElementById("con_three_5").style.display = "none";
    document.getElementById("three2").className = "hover";
    document.getElementById("three1").className = "";
    document.getElementById("three3").className = "";
    document.getElementById("three4").className = "";
    document.getElementById("three5").className = "";
    document.getElementById("three2d").focus();
    document.getElementById('three2d').parentNode.style.backgroundColor='#99CC99';  
    }
    function theforever4()
    {
    document.getElementById("con_three_4").style.display = "block";
    document.getElementById("con_three_1").style.display = "none";
    document.getElementById("con_three_2").style.display = "none";
    document.getElementById("con_three_3").style.display = "none";
    document.getElementById("con_three_5").style.display = "none";
    document.getElementById("three4").className = "hover";
    document.getElementById("three1").className = "";
    document.getElementById("three2").className = "";
    document.getElementById("three3").className = "";
    document.getElementById("three5").className = "";
    document.getElementById("three4d").focus();
    document.getElementById('three4d').parentNode.style.backgroundColor='#99CC99';  
    }*/
    </script>
    </html>
      

  5.   

    谢谢 但是我最想的是theforever1 theforever2 theforever3 theforever4 在单独调用
    有没有办法一个函数搞定了?
      

  6.   

    sxfd321,我投诉你了!我不管你是谁的马甲,好好听着,别搞这么阴损地败坏我名誉的卑鄙无耻的事情!你针对我,这本身我就可以负责地宣称你是个小人,而你这种阴损的行为更加可以证明这一点!不要以为你耍这一点小聪明小手段能糊弄了人。不想想自己是什么智商。你这样分明是针对我的,因为我近期在我的一些回复中使用我自己的ID作函数名。而你用它是什么理由?????还用它来命名这么极其弱智程序!摆明是败坏我的名誉。看你这个马甲上来只发两个帖子,还是这样同样的内容就更明显了。所以,你当然是某人的马甲。是某个不学无术被我批评过的?或者是哪个专门采集CSDN文章的站长? 不管哪种,请你老实点!作人起码有点作人的自尊和脸皮,如果你从小没被告知的话,我现在好好告诉你一声,希望你能认识这几个字。
      

  7.   

    请问你是哪家公司的CEO啊?这么大的面子,你的ID名有没有申请专利?别人用你的ID做函数表示你的声望,至于代码弱不弱智不关你任何事情。 都跟你说了这是别人用的函数名。做人能不能大度点,且有点最基本的判断分析能力?