Revision: 50407
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at August 19, 2011 22:16 by alberomo
Initial Code
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); } }
Initial URL
Initial Description
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.
Initial Title
displayCitations function manual
Initial Tags
javascript
Initial Language
JavaScript