首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

新人请问 笔记本写的应该如何改呢

2013-09-28 
新人请教 笔记本写的应该怎么改呢?htmlheadtitle选项卡/titlestyle#div1.active{background:yel

新人请教 笔记本写的应该怎么改呢?
<html>
  <head>
    <title>选项卡</title>
     <style>
      #div1.active{background:yellow;}
      #div1 div{width:200px;height:200px;background:#CCC;border:1px;
solid #999;display:none;}
     </style>
     <script>
  window.onload=function()
   { 
         var oDiv=document.getElementById("div1");
         var abtn=oDiv.getElementsByTagName("input");
         var aDiv=oDiv.getElementsByTagNanme("div");

       for(var i=0;i<abtn.length;i++)
       {
          abtn[i].index=i;
          abtn[i].onclick=function()
          {
             for(var i=0;i<abtn.length;i++)
             {
                abtn[i].className="";
                aDiv[i].style.display="none"; 
             }
             this.classNanme="active";
             aDiv[this.index].style.display="bolck";
          } ;
       };
   };
     </script>
  </head>
   <body>
     <div id="div1">
      <input class="active" type="button" value="教育">
      <input type="button" value="招生">
      <input type="button" value="出国">
      <input type="button" value="培训">
       <div style="display:block;">111111</div>
       <div>222222</div>
       <div>33333</div>
       <div>44444</div>
     </div>
   </body>
</html>
[解决办法]
都直接用记事本写了还新人


<html>
  <head>
    <title>选项卡</title>
     <style>
      #div1 .active{background:yellow;}
      #div1 div{width:200px;height:200px;background:#CCC;border:1px;
solid #999;display:none;}
     </style>
     <script>
  window.onload=function()
   { 
         var oDiv=document.getElementById("div1");
         var abtn=oDiv.getElementsByTagName("input");
         var aDiv=oDiv.getElementsByTagName("div");

       for(var i=0;i<abtn.length;i++)
       {
          abtn[i].index=i;
          abtn[i].onclick=function()
          {
             for(var i=0;i<abtn.length;i++)
             {
                abtn[i].className="";
                aDiv[i].style.display="none"; 
             }
             this.className="active";
             aDiv[this.index].style.display="block";
          } ;
       };
   };
     </script>
  </head>


   <body>
     <div id="div1">
      <input class="active" type="button" value="教育">
      <input type="button" value="招生">
      <input type="button" value="出国">
      <input type="button" value="培训">
       <div style="display:block;">111111</div>
       <div>222222</div>
       <div>33333</div>
       <div>44444</div>
     </div>
   </body>
</html>

热点排行