Click here to Skip to main content
15,905,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All

am working on asp.net project using c#.

My requirement is, I have Image button on web page for this i have set image url and mouse over.

these are my images, these must set on mouseover , mouseleave and mouseclicked..
1) button_red.jpg
2) button_green.jpg
3) button_yellow.jpg

Normally i have Set imageurl for imagebutton as button_red.jpg
on Mouse over i have set as button_green.jpg

so, this is my code
-------------------

BtnDisplay.Attributes.Add("onmouseover", "this.src='button_red.jpg'");
BtnDisplay.Attributes.Add("onmouseover", "this.src='button_green.jpg'");

so how to set image on mouseclicked. I want to change the color of imagebutton on image clicked.

Please help,

Thanks in advance...
Posted
Comments
ShridharPanigrahi 2-Oct-13 6:06am    
Can you take a look here?
http://www.codeproject.com/Questions/153815/how-we-change-image-in-image-button-on-mouseclick
Azee 2-Oct-13 8:48am    
hey, on mouse click your image button will get a postback, so any javascript will not affect. do you want to keep button_yellow.jpg image after the postback or when user just presses the click button??

1 solution

Hi, if you just want to change the background-color then it is very simple using css,
CSS
.myButton:visited{ background-color: red;}
or if your requirement is something else then please reply to this answer.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900