Click here to Skip to main content
11,709,537 members (48,061 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
how we change image in image button on mouseclick in asp.net
Posted 4-Feb-11 2:22am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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...
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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";
}
  Permalink  
Comments
Marcus Kramer at 4-Feb-11 8:42am
   
+5. Excellent.
Surendra0x2 at 6-Dec-12 7:56am
   
Gr8 Solution Mam :)
Pandurang 11 at 25-Jan-13 3:50am
   
how genrate the NewImage.gif onclick event
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

<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" />
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

what if i want the previous image on next click?
  Permalink  
v2

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 530
1 OriginalGriff 250
2 Peter Leow 229
3 Maciej Los 185
4 Mika Wendelius 160
0 OriginalGriff 9,428
1 Sergey Alexandrovich Kryukov 9,037
2 CPallini 5,189
3 Maciej Los 4,991
4 Mika Wendelius 3,856


Advertise | Privacy | Mobile
Web03 | 2.8.150819.1 | Last Updated 10 Aug 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100