码迷,mamicode.com
首页 > Web开发 > 详细

html中DIV鼠标滑过变换

时间:2014-11-04 17:04:48      阅读:198      评论:0      收藏:0      [点我收藏+]

标签:style   io   ar   java   sp   div   on   2014   cti   

<html>
  <head>
  <meta charset="utf-8">
  <title>无标题文档</title>
  <style type="text/css">
  #div1{
  width:200px;
  height:200px;
  background:#000;
  }
  #div2{
  width:200px;
  height:200px;
  background:#0F0;
  }
  #div3{
  width:200px;
  height:200px;
  background:#00F;
  }
  #div4{
  width:200px;
  height:200px;
  background:#F0F;
  }
  </style>
  <script type="text/javascript">
  function d1(){
  document.getElementById("div4").style.display="none";
  document.getElementById("div3").style.display="none";
  document.getElementById("div2").style.display="none";
  document.getElementById("div1").style.display="block";
  }
  function d2(){
  document.getElementById("div4").style.display="none";
  document.getElementById("div3").style.display="none";
  document.getElementById("div1").style.display="none";
  document.getElementById("div2").style.display="block";
  }
  function d3(){
  document.getElementById("div4").style.display="none";
  document.getElementById("div2").style.display="none";
  document.getElementById("div1").style.display="none";
  document.getElementById("div3").style.display="block";
  }
  function d4(){
  document.getElementById("div2").style.display="none";
  document.getElementById("div3").style.display="none";
  document.getElementById("div1").style.display="none";
  document.getElementById("div4").style.display="block";
  }
  </script>
  </head>
   
  <body>
  <a href="#" onMouseOver="d1()">div1</a>
  <a href="#" onMouseOver="d2()">div2</a>
  <a href="#" onMouseOver="d3()">div3</a>
  <a href="#" onMouseOver="d4()">div4</a>
  <div id="div1" style="display:block"></div>
  <div id="div2" style="display:none"></div>
  <div id="div3" style="display:none"></div>
  <div id="div4" style="display:none"></div>
   
  </body>
  </html>

html中DIV鼠标滑过变换

标签:style   io   ar   java   sp   div   on   2014   cti   

原文地址:http://www.cnblogs.com/xiaosen992608/p/4073637.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!