I am trying to write an after the fact fix for a bug in a blogging install. as it only happens once in a while and is rather minor I figred that javascript could cover the breach.

The javascript changes any instance of domain#1 for the more correct domain#2

Code:
<script language="JavaScript1.2">
<!--
//This hack covers up for BAD code in CMS 
// Edit these two values (mostly the second one should be your domain
var fixdomain="myblog.com";
var mydomain="lordmatt.co.uk";

function dynamiclink(){
for (i=0; i<=(document.links.length-1); i++) {

document.links[i]=document.links[i].replace(fixdomain,mydomain);

}
}
window.onload=dynamiclink;
// -->
</script>
It doesn't work so I figure I done something wrong, but to be honest I suck at javascript. Sometimes it gives me errors in IE6 too.