我希望您能够根据单元格中是否包含URL中的字符 |(竖杠)对表格中的单元格进行样式设置(不要问为什么,因为这涉及到SharePoint)。
HTML示例:
<table>
<tr>
<td class="ms-cal-workitem">
<table>
<tr>
<td class="ms-cal-monthitem">
<a href="http://localhost:4657/1">Event 1</a>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="ms-cal-workitem">
<table>
<tr>
<td class="ms-cal-monthitem">
<a href="http://localhost:4657/1|435348578-kfsd-sdfsf-sfsf-324ewwer">Event 2</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
在任何包含超链接的类为ms-cal-workitem的表格单元格中,应该具有红色背景颜色。唯一的例外是包含字符|在其href属性中的超链接的类为ms-cal-monthitem的表格单元格。
目前为止我得到了什么:
$(document).ready(function() {
$("td.ms-cal-workitem:has(a[href*='|'])").css("background-color", "#ffff99");
$("td.ms-cal-workitem:has(a:not[href*='|'])").css("background-color", "#ffcc33");
});