在asp.net中使用鼠标悬停 [英] using mouseover in asp.net

查看:260
本文介绍了在asp.net中使用鼠标悬停的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在图片(a)上的onmouseover上请求样本代码,而不是这张图片会改为图片(b),图片(c)会改变。这是我的代码

can i ask for a sample code on onmouseover on picture (a) instead of this picture will change to picture (b), picture (c) will change. here is my code

<tr>
	<td>
	<img id="Image1" src="pictures/Image1.jpg" alt="Image1" />
	</td>
	<td>
	<img id="Image2" src="pictures/Image2.jpg" alt="Image2" />
	</td>
</tr>
<tr>
	<td>
	<img id="Image3" src="pictures/Image3.jpg" alt="Image3" />
	</td>
</tr>





如果我悬停在image1,image3将更改为image4,如果我将鼠标悬停在image2上,image3将更改为image5。



谢谢!



if i hover on image1, image3 will change to image4 and if i hover on image2, image3 will change to image5.

Thank you!

推荐答案

步骤

1.使用 onmouseover img标签的属性。

2.在上面调用javaScript函数。

3.通过获取img标签的id,在javaScript函数中做任何你想做的事。



示例代码

Steps
1. Use onmouseover property of img tag.
2. Call javaScript function on that.
3. Do whatever you want in that javaScript function by getting the id of img tags.

Sample Code
<img id="Image1" src="pictures/Image1.jpg" alt="Image1"  önmouseover="changeImage('pictures/Image4.jpg')" />

<img id="Image2" src="pictures/Image2.jpg" alt="Image2"  önmouseover="changeImage('pictures/Image5.jpg')" />




<script type="text/javascript" language="javascript">
    function changeImage(img){
          document.getElementById('Image3').src=img;
    }
</script>


这篇关于在asp.net中使用鼠标悬停的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆