Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript ASP.NET更改中继器内的链接颜色-单击_Javascript_Jquery_Iphone_Asp.net_Repeater - Fatal编程技术网

Javascript ASP.NET更改中继器内的链接颜色-单击

Javascript ASP.NET更改中继器内的链接颜色-单击,javascript,jquery,iphone,asp.net,repeater,Javascript,Jquery,Iphone,Asp.net,Repeater,我有下面的一段标记,我们正在iPhone4上运行它,所以一些CSS元素如Hover不起作用 <asp:Repeater ID="rpt" runat="server"> <HeaderTemplate> <div class="table withshadow"> </HeaderTemplate> <ItemTemplate> <a href='<%#Eval("H

我有下面的一段标记,我们正在iPhone4上运行它,所以一些CSS元素如Hover不起作用

<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>
看到这个问题的替代解决方案(javascript、jquery等)也很好,这样至少其中一个可以在iPhone4上工作:-)

您可以使用jquery

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

请参阅fiddle:

您使用的是所有的伪类,还是仅使用一个?
如果您至少使用了两个,请确保它们的顺序正确,否则它们都会损坏:

a:link
a:visited
a:hover
a:active
按这个顺序。此外,如果您只是使用
:active
,请添加
a:link
,即使您没有设置它的样式。

我们使用了不同的方法(与您的想法类似)。谢谢你的jsfiddle链接。
a:link
a:visited
a:hover
a:active