<script language="javascript">
_links = document.getElementsByTagName("a");
for(i=0;i<_links.length;i++) {
if(_links.name) {
_links.onclick = function() {
window.location = this.name;
return false;
};
_tmp = _links.href;
_links.href = _links.name;
_links.name = _tmp;
}
}
</script>
I just realised that this won't work if they right click and choose open in new window. Here's a new version:
Code:
<script language="javascript">
_links = document.getElementsByTagName("a");
for(i=0;i<_links.length;i++) {
if(_links[i].name) {
docloak = function() {
_cloak = this.href;
this.href = this.name;
this.innerHTML = _cloak;
};
_links[i].oncontextmenu = docloak;
_links[i].onclick = function() {
docloak();
if(!/thickbox/.test(this.className)) {
window.location = this.name;
}
return false;
};
_tmp = _links[i].href;
_links[i].href = _links[i].name;
_links[i].name = _tmp;
}
}
</script>
Code:
var a = this.name || this.href || this.alt;