Changing color of hyperlink when mouse over it

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

When I move my mouse over a hyperlink component, the hyperlink does not
change color.

How do I change the color of a hyperlink when the mouse goes over the
hyperlink?
or
Change the color of a button component when the mouse goes over the button?

I am using Microsfot Visual c#.net Version 7.1.3008

Thanks
 
Hi there... That event happens on the client side so you need a script to
perform the action requested. You can also define a stylesheet and reference
it from the script (this allows you changing colors and appeareance of the
object without recompiling your solution). Hope this can help you.

Regards,
 
I'm pretty new at this so where do I add the script ?
Do I add the scrip In the code behind section or add the script directly in
the HTML section of the Webform1.aspx?
Is there any example that shows one how to do this?
Thank you,
Martha
 
Hi Angel,
Finally figured it out:
For a hyperlink - to change the color when mouse moves over the hyperlink:

<asp:HyperLink id="HyperLink4" runat="server" BorderStyle="None"
NavigateUrl="http://www.cnn.com"
BorderWidth="0px"
onmouseover="this.style.backgroundColor='yellow'"
onmouseout="this.style.backgroundColor='green'"
HyperLink</asp:HyperLink>
I think there is another way to add the same code but in the code behind
section by using attributes but at this point, I am not sure how to do it.
In any case it works for now.
Thank you,
Martha
 
Back
Top