gpt4 book ai didi

jquery - 斑马线剥离在 IE8 中不起作用

转载 作者:行者123 更新时间:2023-12-01 08:11:09 27 4
gpt4 key购买 nike

我编写了以下 jquery 将斑马条纹应用于表中的特定行。这在 Chrome 和 Firefox 中工作正常,但在 IE8 中不起作用。

<script>
$(document).ready(function()
{
$("tr.alt:even").css("background-color", "#f0f8ff");
$("tr.alt:odd").css("background-color", "#fcfceb");
});
</script>

这是 HTML

<tr class="alt">
<td class="status"></td>
<td class>Received</td>
</tr>
<tr class="alt">
<td class="status"></td>
<td class>Received</td>
</tr>
<tr class="alt">
<td class="status"></td>
<td class>Received</td>
</tr>
<tr class="alt">
<td class="status></td>
<td class>Received</td>
</tr>
<tr class="alt">
<td class="status></td>
<td class>Received</td>
</tr>

最佳答案

(在 IE 7,8 中测试...)修复您的标记,它将完美运行:class="status <- 失踪 "
<td class> = 无效属性

<table>
<tr class="alt">
<td class="status"></td>
<td>Received</td>
</tr>
<tr class="alt">
<td class="status"></td>
<td>Received</td>
</tr>
<tr class="alt">
<td class="status"></td>
<td>Received</td>
</tr>
<tr class="alt">
<td class="status"></td>
<td>Received</td>
</tr>
<tr class="alt">
<td class="status"></td>
<td>Received</td>
</tr>
</table>

或者应该是:

<table>
<tr class="alt">
<td class="status"></td>
<td class="Received"></td>
</tr>
<tr class="alt">
<td class="status"></td>
<td class="Received"></td>
</tr>
<tr class="alt">
<td class="status"></td>
<td class="Received"></td>
</tr>
<tr class="alt">
<td class="status"></td>
<td class="Received"></td>
</tr>
<tr class="alt">
<td class="status"></td>
<td class="Received"></td>
</tr>
</table>

我不知道,两者都有效,选择你的选择

关于jquery - 斑马线剥离在 IE8 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13557258/

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