如何使用JavaScript更改鼠标光标焦点上动态生成的链接按钮的颜色?

时间:2022-11-04 21:03:15

Code:

LinkButton linkButton = new LinkButton();
linkButton.OnClientClick="changecolor";--i need to change this to on mouse focus event 

There is no property for link button like we have for onClientClick.

我们对onClientClick没有链接按钮的属性。

2 个解决方案

#1


3  

linkButton.Attributes.Add("onmouseover", "yourChangeColorFunction();");

#2


2  

You can define the CSS class for tha link button that will have different color when you hover.

您可以为悬停时具有不同颜色的tha链接按钮定义CSS类。

a
{
  color:black;
}
a.hover
{
  color:blue;
}

#1


3  

linkButton.Attributes.Add("onmouseover", "yourChangeColorFunction();");

#2


2  

You can define the CSS class for tha link button that will have different color when you hover.

您可以为悬停时具有不同颜色的tha链接按钮定义CSS类。

a
{
  color:black;
}
a.hover
{
  color:blue;
}