gpt4 book ai didi

javascript - 如何不打开重复的链接

转载 作者:行者123 更新时间:2023-12-03 10:49:43 27 4
gpt4 key购买 nike

这是我尝试打开仪表板内所有管道的代码

function() 
{
jQuery("a[href*='pipelines.cgi?pipelines=']").each(function (index, a) {
window.open(a.href, '_blank'); });
}
)();

这是 HTML

  <tr>
<td width="30px">20150131</td>
<td width="470px">

<a href="pipelines.cgi?pipelines=AGS-PART5&dates=20150131">AGS-PART5</a>

(
<a title="View jobs upstream of this pipeline" href="pipelines.cgi?pipelines=AGS-PART5&dates=20150131&action=view-upstream">↑</a>
)
</td>
<td width="15px">
<td>
<td width="280px">
</tr>
<tr>
<td width="30px">20150131</td>
<td width="470px"><a href="pipelines.cgi?pipelines=FBA-MARKETING&dates=20150131">FBA-MARKETING</a>
(
<a title="View jobs upstream of this pipeline" href="pipelines.cgi?pipelines=FBA-MARKETING&dates=20150131&action=view-upstream">↑</a>
)
</td>
<td width="15px">
<td>
<td width="280px">
</tr>

所以问题是我不想打开“查看此管道上游的作业”,但它包含相同的选择器

编辑:感谢大卫·休斯提供的代码。只需要排除一件事。

    <b> 
<a href="pipelines.cgi?pipelines=FBA-WBR&dates=20150207&action=view-dashboard&arg1=‌​last_week"> See how this Dashboard looked at this time last week</a>
</b>

最佳答案

您可以使用 not() 过滤选择以忽略具有标题属性的链接:

function() 
{
jQuery("a[href*='pipelines.cgi?pipelines=']").not("[title]").each(function (index, a) {
window.open(a.href, '_blank'); });
}
)();

关于javascript - 如何不打开重复的链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28459517/

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