zoukankan      html  css  js  c++  java
  • <一>初探js特效魅力之选项卡05

    初探js特效魅力05

    接下来为大家介绍的选项卡的切换

    <!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>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>js特效</title>
    <!-- <link id="link1" rel="stylesheet" type="text/css" href="css1.css" />-->
    <style>
    #div1 .active{
     background:pink;
    }
    #div1 div{
      200px;
      height:200px;
      border:1px solid black;
      background:pink;
      display:none;
     }
    </style>
    <script>
     window.onload=function(){
      var div1=document.getElementById("div1");
      var oBtn=div1.getElementsByTagName("input");
      var oDiv=div1.getElementsByTagName("div");
      
      for(var i=0;i<oBtn.length;i++){
       oBtn[i].index=i;
       oBtn[i].onclick=function(){
        for(var i=0;i<oBtn.length;i++){
         oBtn[i].className=''; 
         oDiv[i].style.display='none';
        }
        this.className='active';
        oDiv[this.index].style.display="block";
       }
      }
     }
     </script>
    </head>
    <body>
    <div id="div1">
     <input type="button" class='active' value="教育" id="btn1"/>
        <input type="button" value="培训" id="btn2"/>
        <input type="button" value="出国" id="btn3"/>
        <input type="button" value="其他" id="btn3"/>
        <div style="display:block">111</div>
        <div>222</div>
        <div>333</div>
        <div>4444</div>
     </div>  
    </body>
    </html>

    未完待续,请继续收看初探js特效魅力06

  • 相关阅读:
    设计模式基本原则及实例
    Springboot中发送邮件util
    mysql表关联查询索引不生效问题
    个人读书清单整理
    mysql 显示每条记录行号
    Axure教程
    Tomcat配置及原理文章
    HTTPS 简单学习
    Python实现二叉树的非递归先序遍历
    和HTTP相关的web服务器内容
  • 原文地址:https://www.cnblogs.com/keanuyaoo/p/3356031.html
Copyright © 2011-2022 走看看