User:DavidBrooks/recolor.js

// Include this with code like the following: // document.write(' ');

var recol_onoff; recol_onoff=0;

function recolorone(tag, which) { tag.style.color = which?"#000000":""; tag.style.textDecoration = which?"none":""; }

function glow { recolorone(this, 0); /* Return to default (style sheet) coloring */ }

function unglow { recolorone(this, 1); /* Force hidden links */ }

function recolor { recol_onoff = 1 - recol_onoff; var tagid; var alltags = document.getElementById("article").getElementsByTagName('A'); for (var thistag = 0; alltags[thistag]; thistag++) { tagid = alltags[thistag]; recolorone(tagid, recol_onoff); if (recol_onoff) { tagid.onmouseover = glow; tagid.onmouseout = unglow; } else { tagid.onmouseover = tagid.onmouseout = null; } } return false; }

function tagh { document.getElementsByTagName('h1')[0].onclick = recolor; }

if (window.addEventListener) window.addEventListener("load",tagh,false); else if (window.attachEvent) window.attachEvent("onload",tagh);