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=" width:100px; height:35px; color:#0F0; text-align:center; vertical-align:middle; line-height:35px;" οnclick="xiala()">首页</div> <div id="cd1" style=" display:none"> <div>企业介绍</div> <div>产品介绍</div> <div>产品中心</div> <div>服务中心</div> <div>联系我们</div> </div> <div style=" width:100px; height:35px; color:#0F0; text-align:center; vertical-align:middle; line-height:35px;" οnclick="xiala2()">企业介绍</div> <div id="cd2" style=" display:none"> <div>产品介绍</div> <div>产品中心</div> <div>服务中心</div> <div>联系我们</div> </div> <div style=" width:100px; height:35px; color:#0F0; text-align:center; vertical-align:middle; line-height:35px;" οnclick="xiala3()">产品中心</div> <div id="cd3" style=" display:none"> <div>产品介绍</div> <div>产品中心</div> <div>服务中心</div> <div>联系我们</div> </div> <br /> <br /> <br /> <!--<div style="width:600px; height:35px; border:1px solid #000; text-align:center; vertical-align:middle; line-height:35px; color:#F00;">--> <div id="a1" style="overflow:hidden" οnmοuseοver="chuxian()" οnmοuseοut="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>

 

转载于:https://www.cnblogs.com/chaochao00o/p/6287005.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值