Click here to Skip to main content
15,908,111 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how we change image in image button on mouseclick in asp.net
Posted

use jquery

$(function () {

$("#my_image").bind("click", function() {
      $("#my_image").attr("src","second.jpg");
});

});



or javascript

document[img_name].src = img_src;



Hope this helps...
 
Share this answer
 
<asp:imagebutton id="ImageButton1" runat="server" class="Login-Image-Login" onclick="Home_Click" height="30px" width="200px" xmlns:asp="#unknown">
ImageUrl="~/Images/Home.png" onmouseover="this.src='../Images/HomeClick.png';" onmouseout="this.src='../Images/Home.png';" CausesValidation="false" />
 
Share this answer
 
Your question is not clear and if I did understand clearly

<asp:ImageButton runat="server" ImageUrl="SomeImage.gif"
OnClick="Image1_Click"/>

Protected void Image1_Click(ObjectSender, ImageClickEventArgs e) 
{
  Image1.ImageUrl="NewImage.gif";
}
 
Share this answer
 
Comments
fjdiewornncalwe 4-Feb-11 8:42am    
+5. Excellent.
Surendra0x2 6-Dec-12 7:56am    
Gr8 Solution Mam :)
Pandurang 11 25-Jan-13 3:50am    
how genrate the NewImage.gif onclick event
what if i want the previous image on next click?
 
Share this answer
 
v2

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