html - 如何在页面内链接到文本引用和尾注引用后突出显示它们

标签 html bibliography citations

我按照以下方式将我的引文链接到我的尾注,并将我的尾注链接到我的引用书目:

<h1>Title</h1>
<hr />

<p>This is a citation where "[1]" links to "&uarr;" in Endnotes and vice-versa.<a id="citation1" href="#endnote1"><sup>[1]</sup></a></p>

<h1>Endnotes</h1>
<hr />

<ol>
 <li><a id="endnote1" href="#citation1">&uarr;</a>This is an endnote where this <a href="#Short title of reference"><i>Short title of reference</i></a> links to entire <i>reference</i> in Bibliography.</li>
</ol>

<h1>Bibliography</h1>
<hr />

<ul>
 <li><a id="Short title of reference">Here goes the entire <i>reference</i>.</a></li>
</ul>

产生:

标题


这是一个引文,其中“[1]”链接到尾注中的“↑”,反之亦然。[1]

尾注


  1. ↑这是一个尾注,其中这个引用文献的简短标题链接到引用书目中的整个引用文献

引用书目


  • 这里是整个引用

现在,我希望 [1]、↑ 和 Short title of reference 链接到的项目在相应的链接将我带到它时突出显示。如何实现这一目标?

最佳答案

是这样的:

  <h1>Title</h1>
  <hr/>

  <p>This is a citation.<sup><a id="citation_1" href="#endnote_1" onfocus="highlight(this)" onblur="deHighlight(this)">[1]</a></sup></p>

  <h1>Endnotes</h1>
  <hr/>

  <ol>
    <li><a id="endnote_1" href="#citation_1" onfocus="highlight(endnote_1Content)" onblur="deHighlight(endnote_1Content)">&uarr;</a><span id="endnote_1Content">This is an endnote citing this <abbr title="Full book title"><a href="#bibliography_1">Short title</a></abbr> for a book.</span></li>
  </ol>

  <h1>Bibliography</h1>
  <hr />

  <ul>
    <li><a id="bibliography_1" href="#" onfocus="highlight(bibliography_1Content)" onblur="deHighlight(bibliography_1Content)"></a><span id="bibliography_1Content">This is a reference for the entire book.</span></li>
  </ul>

  <script>
    function highlight(x) {
      x.style.background = "lightgrey";
    }

    function deHighlight(x) {
      x.style.background = "";
    }
  </script>

关于html - 如何在页面内链接到文本引用和尾注引用后突出显示它们,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45361422/

相关文章:

javascript - 包括需要很长时间才能加载,您可以看到它们正在加载

javascript - 跟踪指令中的代码脚本

html - 不确定我犯了什么类型的错误。 CSS3 和移动显示

xml - 是否可以在 CSL 样式中将 "et al."斜体化?

php - 来自一张表的自定义输出数据

Pandoc 引用而不附加引用书目

LaTeX 和 Bibtex : command to print a single full reference from a bib file?

r - 在 RMarkdown 文档中使用引用书目时,如何在 RStudio 中使用 --citeproc 而不是 pandoc-citeproc?

latex - 编译 LaTex 围脖源码

formatting - 使用 LaTeX Beamer 将引文文本放在同一张幻灯片上