我按照以下方式将我的引文链接到我的尾注,并将我的尾注链接到我的引用书目:
<h1>Title</h1>
<hr />
<p>This is a citation where "[1]" links to "↑" 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">↑</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]、↑ 和 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)">↑</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/