我有一个网页使用javascript来显示链接。但我想简单地复制链接,所以我需要搜索并替换所有行,如下所示:
<a href="javascript:;" class="question-link" data-question-id="34144011">Error 1606 while installation</a>通过以下方式:
<a href="htt ps://www.domain.com/?qid=34144011">Error 1606 while installation</a>有什么帮助吗?这是我的第一个脚本,但我自己做不到。
发布于 2020-11-11 03:01:33
基于所给出的示例,下面是一个示例
// <a href="javascript:;" class="question-link" data-question-id="34144011">Error 1606 while installation</a>
// assuming there are a number of such links with class="question-link"
document.querySelectorAll('a.question-link').forEach(a =>
a.href = 'https://www.example.com/?qid=' + a.dataset.questionId);https://stackoverflow.com/questions/64719601
复制相似问题