显示引文功能手册
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了显示引文功能手册相关的知识,希望对你有一定的参考价值。
JS function that add a link included in the cite attribute of the blackquote html element as sup element close to the blackquote. Takes no argument.From book Dom Scripting by Jeremy Keith.
function displayCitations() { var quotes = document.getElementsByTagName("blockquote"); for (var i=0; i<quotes.length; i++) { if (!quotes[i].getAttribute("cite")) continue; var url = quotes[i].getAttribute("cite"); var quoteChildren = quotes[i].getElementsByTagName("*"); var quoteChildren = quotes[i].getElementsByTagName('*'); if (quoteChildren.length < 1) continue; var elem = quoteChildren[quoteChildren.length - 1]; var link = document.createElement("a"); var link_text = document.createTextNode("source"); link.appendChild(link_text); link.setAttribute("href",url); var superscript = document.createElement("sup"); superscript.appendChild(link); elem.appendChild(superscript); } }
以上是关于显示引文功能手册的主要内容,如果未能解决你的问题,请参考以下文章