我想点击它时更改超链接颜色 [英] I want to change hyperlink color when I click on it

查看:82
本文介绍了我想点击它时更改超链接颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了这个,但没有得到输出



i used this but didn't got the output

a.Grid:visited {
    border:1px ridge black;
    color:Purple;
}

<asp:LinkButton ID="lnkPage" runat="server" Text = '<%#Eval("Text") %>' CssClass="Grid"></asp:LinkButton>

推荐答案

你试图申请链接的css不会在回发后持续存在,就像我们以前做的那样悬停。



您应该尝试使用Javascript / Jquery或后面的代码更改它。



The css you were trying to apply for link visited wont be persisting after the postback as we used to do it for a hover.

you should try to change it using Javascript/Jquery or in the code behind as below .

protected void LinkButton1_Click(object sender, EventArgs e)
       {
           LinkButton lb = (LinkButton)sender;
           lb.ForeColor = System.Drawing.Color.Purple;
       }







<asp:LinkButton ID="LinkButton1" runat="server" ForeColor="Black" OnClick="LinkButton1_Click">My Link Button</asp:LinkButton>





希望这有帮助......



Hope this helps...


HI



以下代码可能会对您有所帮助。



http://stackoverflow.com/questions/8272729/asp-net-change-link-button-color-when-clicked-without-post-back- or-update-panel?rq = 1 [ ^ ]


http://www.webmasterworld。 com / css / 3725864.htm

试试这个
http://www.webmasterworld.com/css/3725864.htm
try this


这篇关于我想点击它时更改超链接颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆