Fwd: Bookmarklet to show anchors and ids in a DOM Level 1 compliant browser]

Hello,

It was suggested that this bookmarket, that allows to visualize anchors
in a document, could be usefully sent to this forum. It was originally
archived at:
http://lists.w3.org/Archives/Public/www-archive/2003Aug/0028.html

-----Message suivi-----

> From: Dominique Hazaël-Massieux <dom@w3.org>
> To: www-archive@w3.org
> Subject: Re: Bookmarklet to show anchors and ids in a DOM Level 1 compliant browser
> Date: 25 Aug 2003 16:59:08 +0200
> 
> [Follow-up on
> http://lists.w3.org/Archives/Public/www-archive/2002Jul/0005.html ]
> 
> This bookmarklet makes appear an image of anchor after every tag with an
> id or an anchor with a name; this image gives the link to the given
> anchor:
> javascript:(function(){var i,n,a,j,l;b=document.getElementsByTagName('*');for(i=0;i<b.length;++i){a=b[i];if(a.id||(a.tagName=="A"&&a.name)){j=document.createElement("img");j.src="http://www.w3.org/2003/08/anchor";j.style.border="none";j.alt="";if(a.id){n=a.id;}else{n=a.name;};if(a.tagName!="A"){l=document.createElement("a");}else{l=a;};l.href="#"+n;l.appendChild(j);if(a.tagName!="A"){a.appendChild(l);};l.style.border="1px solid black";}}})();
> 
> Note that it doesn't work in Internet Explorer before version 6.0 due to
> the lack of interpretation of document.getElementsByTagName('*')
> 
> (the only change compared to the previous version is to use a www.w3.org
> image rather than an image from my personal site).

Dom
-- 
Dominique Hazaël-Massieux - http://www.w3.org/People/Dom/
W3C/ERCIM
mailto:dom@w3.org

Received on Friday, 5 December 2003 11:11:56 UTC