#javascript-code-28-insertbefore.js / js
// Find all the <a> links within the document var a = document.getElementsByTagName(“a”); for ( var i = 0; i < a.length; i++ ) { // Create an image of the linked-to site’s favicon var img = document.createElement(“img”); img.src = a[i].href.split('/').splice(0,3).join('/') + '/favicon.ico'; // Insert the image before the link a[i].parentNode.insertBefore( img, a[i] ); }
(C) Æliens 20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.