Gracias, Wikipedia.
ShareCode
Permalink: http://www.treeweb.es/u/974/ 01/02/2011

ShareCode

1 var info = null;2 3 var treedoc = null;4 5 var last_editable = null;6 7 8 9 10 window.addEventListener('load', function(event) {11  treedoc = document.getElementById('treedoc-1');12  treedoc.root = true;13  info = document.getElementById('info');14  15  treedoc.addEventListener('keydown', function(event){16  //event.preventDefault();17  event.stopPropagation(); 18  19  var selection = window.getSelection();20  var anchor = selection.anchorNode;21  if (anchor.nodeType != anchor.ELEMENT_NODE) anchor = anchor.parentNode;22  23  //properties(anchor);24  25  26  /*27  var ma = anchor;28  info.innerHTML = anchor.tagName;29  while (!ma.root) {30  ma = ma.parentNode;31  info.innerHTML = ma.tagName + ' > ' + info.innerHTML;32  }*/33  34  }, true); 35 },true);36 37 function properties(o) {38  var s = '';39  for(key in o)40  s += key + '=' + o[key] + '<br>';41  info.innerHTML = s;42 }
Enlace
El enlace para compartir es: