求在javascript中编写一个或者两个函数让鼠标经过标题文字时图片也跟着一起换,有五张图片,求好心人。
<body><divclass="box"><divid="main"><ul><lionmouseover="get(1);"onmouseout="a(1)"><ah...
<body>
<div class="box">
<div id="main">
<ul>
<li onmouseover="get(1);" onmouseout="a(1)"><a href="#">资讯</a></li>
<li onmouseover="get(2);" onmouseout="a(2)"><a href="#">娱乐</a></li>
<li onmouseover="get(3);" onmouseout="a(3)"><a href="#">体育</a></li>
<li onmouseover="get(4);" onmouseout="a(4)"><a href="#">汽车</a></li>
<li onmouseover="get(5);" onmouseout="a(5)"><a href="#">历史</a></li>
</ul>
</div>
<div class="second">
<div class="s1">
<img src="images/14074732.jpg" />
</div>
<div class="s2">
<img src="images/13375632.jpg" />
</div>
<div class="s3">
<img src="images/14073432 (1).jpg" />
</div>
<div class="s4">
<img src="images/14544832.jpg" />
</div>
<div class="s5">
<img src="images/rdn_51b93d80826fb.jpg" />
</div>
</div>
</div>
</body> 展开
<div class="box">
<div id="main">
<ul>
<li onmouseover="get(1);" onmouseout="a(1)"><a href="#">资讯</a></li>
<li onmouseover="get(2);" onmouseout="a(2)"><a href="#">娱乐</a></li>
<li onmouseover="get(3);" onmouseout="a(3)"><a href="#">体育</a></li>
<li onmouseover="get(4);" onmouseout="a(4)"><a href="#">汽车</a></li>
<li onmouseover="get(5);" onmouseout="a(5)"><a href="#">历史</a></li>
</ul>
</div>
<div class="second">
<div class="s1">
<img src="images/14074732.jpg" />
</div>
<div class="s2">
<img src="images/13375632.jpg" />
</div>
<div class="s3">
<img src="images/14073432 (1).jpg" />
</div>
<div class="s4">
<img src="images/14544832.jpg" />
</div>
<div class="s5">
<img src="images/rdn_51b93d80826fb.jpg" />
</div>
</div>
</div>
</body> 展开
2个回答
展开全部
给你写一个例子
js部分:
$(document).ready(function(){
$('#z').mouseover(function(){
$('#1').show();
});
$('#z').mouseout(function(){
$('#1').hide();
});
});
jsp部分:
<li id="z"><a href="#">资讯</a></li>
<div class="s1" id="1" style="display: none">
<img width="30%" height="30%" src="images/1.jpg" />
</div>
追问
不太明白。
追答
额,就是通过js控制它的div 的方式是显示还是隐藏
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询