鼠标滑过选项卡切换图片

<!DOCTYPE  HTML>

<html>

<head>

<meta  charset="utf-8">

<title>鼠标滑过选项卡切换图片</title>

<style>

input{background:white;}

.active{background:red;}

div{

   width:300px;

   height:200px;

   background:gray;

   margin-bottom:10px;

  display:none;

  

}


</style>

<script>

     window.οnlοad=function  ()

 {

      var   oInput=document.getElementsByTagName('input');

  var   oDiv=document.getElementsByTagName('div');

  var  i=0;

    for(i=0;i<oInput.length;i++)

          {  

 oInput[i].index=i

             oInput[i].οnmοuseοver=function  ()

  {

  for(i=0;i<oInput.length;i++)

  {

     oInput[i].style.background="none";

 oDiv[i].style.display="none";

  }

    this.style.background="red";

oDiv[this.index].style.display="block";

  }

           }

 }

</script>



</head>

<body>

<input    class="active"  type="button"    value="按钮1">

<input     type="button"    value="按钮2">

<input    type="button"    value="按钮3"  >

<div   style="display:block">

<img  src="./images/u=1259803343,3860580242&fm=11&gp=0.jpg"  width='300px'  height='200px'  title=""   alt=""  />

</div>

<div>

<img  src="./images/u=1491680822,4259060158&fm=21&gp=0.jpg"  width='300px'  height='200px' title=""   alt=""  />

</div>

<div>

<img  src="./images/u=2092545718,2399576582&fm=21&gp=0.jpg"  width='300px'  height='200px' title=""   alt=""  />

</div>



</body>

</html>


转载于:https://my.oschina.net/LeesurYoo/blog/652513

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值