Changing a picture OnMouseOver

  • Thread starter Thread starter Carlos Cruz
  • Start date Start date
C

Carlos Cruz

Hi,

I'm just starting ASPNET. Suposing that I've 2 images and I'd like to change
the image on the right when I pass the mouse over the image on the left.
Could anyone tell me how can I do that?

Thanks
CC
 
Hi Carlos,
You can do it through JavaScript.Use onmouseover event.
If you use image buttons,
In your code behind
if Imagebutton1 is an image button,
if(!IsPostBack){
Imagebutton1.Attributes.Add("onmouseover","image_mouseover();");
}
on your client side
<script language="JavaScript">
function image_mouseover(){
put your javascript code to change the image on the other side..

}
</script>

Hope this helps.
Regards,
Marshal Antony
..NET Developer
http://www.dotnetmarshal.com
 
Thanks for your help

I'm using webcontrols.image and not Imagebutton (mabe it's wrong but I'm
really starting).
Te problem is... could you tell me exactly how to change the image in
JavaScript code and also tell me where can I start learning JavaScript?

Thanks again,
CC
 
Hi Carlos,

Here are somes links to help learning JavaScript :

http://hotwired.lycos.com/webmonkey/programming/javascript/
http://www.w3schools.com/js/default.asp
http://developer.irt.org/script/script.htm

Here is a link on Javascript and ASP.NET
http://www.dotnetbips.com/displayarticle.aspx?id=8
Some examples specific to using images and onMouseover/onMouseout
http://developer.irt.org/script/952.htm
http://www.javascriptkit.com/javatutors/image4.shtml
Search in search engines like google.com which will give you lot of
links which can help you.
Hope this helps,
Regards,
Marshal Antony
..NET Developer
http://www.dotnetmarshal.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top