[thelist] skipping 'hx' levels is bad

Hassan Schroeder hassan at webtuitive.com
Thu Jan 17 14:10:51 CST 2002


rudy wrote:

> this has been a great thread, but let's kill it

Yes indeed, but it got me thinking about the value of outlines, so
I wrote a quick JavaScript outliner - NS6 *only* at the moment!

Put a link like:   <a href="javascript:outline();">outline</a>
into a page, and 
it'll hide everything but the 'Hn's -- with the exception that 
any text outside an enclosing element will also remain, which
isn't a bad thing to see either (IMHO!).  

function outline ()
{
	allTags = document.getElementsByTagName('*');
	for ( i = 0; i < allTags.length; i++ )
	{
		switch ( allTags[i].nodeName )
		{
			case "H1":
				allTags[i].style.color = "#ff0000";
				allTags[i].style.marginLeft = "0";
				break;
			case "H2":
				allTags[i].style.color = "#cc0000";
				allTags[i].style.marginLeft = "5%";
				break;
			case "H3":
				allTags[i].style.color = "#990000";
				allTags[i].style.marginLeft = "10%";
				break;
			case "H4":
				allTags[i].style.color = "#660000";
				break;
			case "H5":
				allTags[i].style.color = "#330000";
				break;
			case "H6":
				allTags[i].style.color = "#000000";
				break;

			case "BODY": 
				allTags[i].style.display = "inherit";
				break;

			default:
				allTags[i].style.display = "none";
				break;
		}
	}
}

Minimal testing, no warranty, YMMV, yadda yadda ...
-- 
H*
Hassan Schroeder ----------------------------- hassan at webtuitive.com 
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

    -- creating dynamic Web sites and applications since 1994 --




More information about the thelist mailing list