Solved

MouseOver Effects using ASP.NET

Posted on 2004-04-19
8
730 Views
Last Modified: 2012-08-13
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
Comment
Question by:bchia
8 Comments
 
LVL 28

Expert Comment

by:mmarinov
ID: 10857820
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
 
LVL 8

Expert Comment

by:dishanf
ID: 10857826
You must do it through java script
0
 

Author Comment

by:bchia
ID: 10857841
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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 28

Accepted Solution

by:
mmarinov earned 20 total points
ID: 10857849
<script language=javascript>
 function changeimage(src)
 {
  imagebuttonname.src = src;
 }
</script>

B..M
0
 
LVL 8

Expert Comment

by:dishanf
ID: 10857856
0
 
LVL 6

Expert Comment

by:zulu_11
ID: 10859111
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

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now