Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 739
  • Last Modified:

MouseOver Effects using ASP.NET

Hi how do you do mouseover effect on a button in a form?

When you put ur mouse over the button image (but1.gif), I want it to change to another button image (but2.gif). I tried onmouseover, but ASP.NET doesnt recognise it.

My current code is:

<asp:ImageButton OnClick="SubmitHandler" Runat="server" BorderWidth="0" ImageUrl="but1.gif" />

How should I manipulate it so it does the mouseover effect?
0
bchia
Asked:
bchia
1 Solution
 
mmarinovCommented:
add ID attribute to your ImageButton, for example ID="ImageOnMouseOver"

in your code behind
use this

ImageOnMouseOver.Attributes.Add ("onmouseover", "yourjavascript code" )

B..M

0
 
Dishan FernandoSoftware Engineer / DBACommented:
You must do it through java script
0
 
bchiaAuthor Commented:
Thanks heaps :)

I did what u said.. Only one more problem..
What would the javascript code be for changing image, for example, from but1.gif to but2.gif?

0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
mmarinovCommented:
<script language=javascript>
 function changeimage(src)
 {
  imagebuttonname.src = src;
 }
</script>

B..M
0
 
Dishan FernandoSoftware Engineer / DBACommented:
0
 
zulu_11Commented:
in addition to the code given by mmarinov..add another similar code for onMouseOut so that when the mouse moves away from the button , it gets back to the original image..

Zulu
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now