zoukankan      html  css  js  c++  java
  • 11.10document对象练习

    <!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>无标题文档</title>
    <style>
    #cd1{ width:100px; height:175px; background-color:#900; color:#0F0; text-align:center; vertical-align:middle; line-height:35px; }
    #cd2{ width:100px; height:175px; background-color:#900; color:#0F0; text-align:center; vertical-align:middle; line-height:35px; }
    #cd3{ width:100px; height:175px; background-color:#900; color:#0F0; text-align:center; vertical-align:middle; line-height:35px; }
    #a1{ width:100px; height:35px; background-color:#0F0; text-align:center; vertical-align:middle; line-height:34px; border:1px solid #000;}
    #a2{ width:100px; height:35px; background-color:#0F0; text-align:center; vertical-align:middle; line-height:34px; border:1px solid #000;}
    
    
    
    
    
    </style>
    </head>
    
    <body>
    
        <div style=" 100px; height:35px;  color:#0F0; text-align:center; vertical-align:middle; line-height:35px;" onclick="xiala()">首页</div>
        
        <div id="cd1" style=" display:none">
        <div>企业介绍</div>
        <div>产品介绍</div>
        <div>产品中心</div>
        <div>服务中心</div>
        <div>联系我们</div>
        </div>
    
        <div style=" 100px; height:35px;  color:#0F0; text-align:center; vertical-align:middle; line-height:35px;" onclick="xiala2()">企业介绍</div>
        
        <div id="cd2" style=" display:none">
        <div>产品介绍</div>
        <div>产品中心</div>
        <div>服务中心</div>
        <div>联系我们</div>
        </div>
        
        <div style=" 100px; height:35px;  color:#0F0; text-align:center; vertical-align:middle; line-height:35px;" onclick="xiala3()">产品中心</div>
        
        <div id="cd3" style=" display:none">
        <div>产品介绍</div>
        <div>产品中心</div>
        <div>服务中心</div>
        <div>联系我们</div>
        </div>
    
    
    <br />
    <br />
    <br />
    <!--<div style="600px; height:35px; border:1px solid #000; text-align:center; vertical-align:middle; line-height:35px; color:#F00;">-->
        <div id="a1" style="overflow:hidden" onmouseover="chuxian()" onmouseout="yincang()">
        <div id="a2">产品介绍</div>
        <div id="a2">产品中心</div>
        <div id="a2">企业介绍</div>
        <div id="a2">联系我们</div>
        </div>
    </div>
    </body>
    </html>
    <script type="text/jscript">
    function xiala(a)
    {
        var a = document.getElementById("cd1");
        var str="none";
        if(str.indexOf(a.style.display)>=0)
        {
        a.style.display="block";
        }
        else(a.style.display="none")
        
    }
    
    
    function xiala2()
    {
        var a = document.getElementById("cd2");
        var str="none";
        if(str.indexOf(a.style.display)>=0)
        {
        a.style.display="block";
        }
        else a.style.display="none";
    }
    
    function xiala3()
    {
        var a = document.getElementById("cd3");
        var str="none";
        if(str.indexOf(a.style.display)>=0)
        {
        a.style.display="block";
        }
        else a.style.display="none";
    }
    
    
    function chuxian()
    {
        var a = document.getElementById("a1");
        a.removeAttribute("style");
    }
    
    function yincang()
    {
        var a = document.getElementById("a1");
        a.setAttribute("style","overflow:hidden");
    }
    </script>
  • 相关阅读:
    进阶系列(8)——匿名方法与lambda表达式
    进阶系列(3)—— 序列化与反序列化
    进阶系列(4)——扩展方法
    数据库设计开发规范
    .Net 项目代码风格
    用JS获取地址栏参数的方法(超级简单)
    Ajax轮询 select循环输出
    【Jquery】jquery刷新页面(局部及全页面刷新)
    网页上 滚动代码 最简单的
    eazyui 或bootstrap table表格里插入图片,点击查看大图
  • 原文地址:https://www.cnblogs.com/chaochao00o/p/6287005.html
Copyright © 2011-2022 走看看