atuccillo
asked on
ASP Image BorderColor Change on mouseover
I'm writing a .NET website using c#. I am making a photo gallery and have the images within asp:Image components. Here is the code for the components:
<asp:Image ID="thumbnail01" runat="server" BorderColor="Green" BorderWidth="2px" />
On mouseover, I want the image border color to change. I tried this with no luck:
thumbnail01.Attributes.Add ("onmouseo ver", "document.getElementById(t humbnail01 ').BorderC olor='Red' ");
I also tried this with no luck:
thumbnail01.Attributes.Add ("onmouseo ver", "document.getElementById(' thumbnail0 1').style. BorderColo r='Red'");
And this:
thumbnail01.Attributes.Add ("onmouseo ver", "this.BorderColor='Red'");
I also tried doing it through a stylesheet with no luck What am I missing here? Is there a special way to reference a BorderColor in an asp:Image?
<asp:Image ID="thumbnail01" runat="server" BorderColor="Green" BorderWidth="2px" />
On mouseover, I want the image border color to change. I tried this with no luck:
thumbnail01.Attributes.Add
I also tried this with no luck:
thumbnail01.Attributes.Add
And this:
thumbnail01.Attributes.Add
I also tried doing it through a stylesheet with no luck What am I missing here? Is there a special way to reference a BorderColor in an asp:Image?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Ooopps, too late after enter the comment...
Instead try using JQuery
http://www.dotnetcube.com/post/Getting-started-with-JQuery-in-ASPNET.aspx
This way you can make it reusable and much more intuitive - easy to implement.
http://www.dotnetcube.com/post/Getting-started-with-JQuery-in-ASPNET.aspx
This way you can make it reusable and much more intuitive - easy to implement.
thumbnail01.Attributes.Add
Javascript is Case Sensative
so change BorderColor to borderColor as shown above