gpt4 book ai didi

javascript - ASP .NET 更改转发器内的链接颜色 - 单击时

转载 作者:行者123 更新时间:2023-12-02 18:56:00 25 4
gpt4 key购买 nike

我有以下标记,我们在 iphone 4 上运行它,因此一些 CSS 元素(如悬停)不起作用。

<asp:Repeater ID="rpt" runat="server">
<HeaderTemplate>
<div class="table withshadow">
</HeaderTemplate>
<ItemTemplate>
<a href='<%#Eval("HistoryTeacherURL")%>' class="tablerow list navigate">
<div class="tablecell listitem left">
<asp:Label ID="lblDesc" Text='<%#Eval("Name")%>' runat="server" CssClass="item" /><br />
</div>
<div class="tablecell listitem right">
<touch:TutorialSheets ID="lblBal" Text='<%#Eval("Tutorial")%>' runat="server" CssClass="amount item" />
</div>
<div class="tablecell listitem witharrow">
</div>
</a>
</ItemTemplate>
<FooterTemplate>
</div>
</FooterTemplate>
</asp:Repeater>

我们想要的是,当我们点击链接时,颜色应该变成红色!问题是这种类型的 CSS 可以在 Firefox 上运行,但不能在 iphone 4 上运行。

a:active
{
background-color: #31ac48;
font-color: #ffffff;
}

如果能看到这个问题的替代解决方案(javascript、jquery 等)那就太好了,这样至少其中一个可以在 iphone 4 上运行:-)

最佳答案

您可以使用 jQuery。

$("a").click(function() {
if $(this).is(":active") {
(this).css("font-color", "red");
}
});

参见 fiddle :http://jsfiddle.net/bMyMd/

关于javascript - ASP .NET 更改转发器内的链接颜色 - 单击时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15352828/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com