»
AnglaisFrançaisVietnamien

Imprimer - Lien Annotations - JavaScriptBank.com

Version complète: jsB@nk » Lien » Tooltip » Lien Annotations
URL: https://www.javascriptbank.com/link-annotations.html

Lien Annotations © JavaScriptBank.comBeaucoup de sites contiennent une page avec des liens vers d'autres ressources connexes. En règle générale, une description de chaque site ne sont pas fournies, à moins que le visiteur plane sur la Attribut TITLE de la balise ancre. Les descriptions peuvent être indiquées sur la page, avec les liens, mais qui le rendrait trop lourde. Ce script va afficher et masquer le lien du titre d'information à droite sur la page. Elle pourrait être utilisée dans un Plan du site ou menu dynamique ainsi.

Version complète: jsB@nk » Lien » Tooltip » Lien Annotations
URL: https://www.javascriptbank.com/link-annotations.html



JavaScript
<script type="text/javascript"><!--/* This script and many more are available free online at   The JavaScript Source :: http://javascript.internet.com   Created by: JTricks.com :: http://www.jtricks.com/   Licensed under: U.S. Copyright   Version: 20060105   Latest version:   www.jtricks.com/javascript/navigation/annotations.html */function add_titles(cls) {  var as = document.getElementsByTagName('a');  var i = 0;  while (i < as.length) {    var a = as.item(i);    i++;    if (a.className != cls) {      continue;    }    if (a.nextSibling &&        a.nextSibling.nodeName == 'DIV' &&        a.nextSibling.firstChild &&        a.nextSibling.firstChild.nodeName == '#text' &&        a.nextSibling.firstChild.nodeValue == a.title) {      continue;    }    var title = document.createElement("div");    title.appendChild(document.createTextNode(a.title));    a.parentNode.insertBefore(title, a.nextSibling);  }}function remove_titles(cls) {  var as = document.getElementsByTagName('a');  var i = 0;  while (i < as.length) {    var a = as.item(i);    i++;    if (a.className != cls) {      continue;    }    if (a.nextSibling &&        a.nextSibling.nodeName == 'DIV' &&        a.nextSibling.firstChild &&        a.nextSibling.firstChild.nodeName == '#text' &&        a.nextSibling.firstChild.nodeValue == a.title)    {    a.parentNode.removeChild(a.nextSibling);    }  }}function toggle_titles() {  var anchorsClassName = 'linkDemo';  var box = document.getElementById('toggle_titles_checkbox');  if (box.checked)    add_titles(anchorsClassName);  else    remove_titles(anchorsClassName);}function createTitles() {  if (document.getElementsByTagName) {    document.write('<input id="toggle_titles_checkbox" type="checkbox" ' + 'onclick="toggle_titles()">Show link descriptions');    if (window.addEventListener)      window.addEventListener("load", toggle_titles, false);    else if (window.addEvent)      window.addEvent("load", toggle_titles);  }}//--></script><script type="text/javascript"><!--  createTitles();//--></script>


HTML
<ul>  <li><a href="http://www.webdeveloper.com/" class="linkDemo" title="Check out these great forums!">Web Developer</a></li>  <li><a href="http://javascriptbank.com/" class="linkDemo" title="Over 2,500 scripts for you to use ... free!">JavaScript Bank</a></li>  <li><a href="http://www.webreference.com/" class="linkDemo" title="Dev the Web!&#8482;">WebReference.com</a></li></ul>