Fijate si así te sirve:
Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>test</title>
<script>
function addEvent(obj, evType, fn, useCapture){
if (obj.addEventListener){
obj.addEventListener(evType, fn, useCapture);
return true;
} else if (obj.attachEvent){
var r = obj.attachEvent("on"+evType, fn);
return r;
} else {
alert("nop");
}
}
function ventana(e){
var e=e || window.event;
var el=e.srcElement || e.target;
var url=el.href;
window.open(url);
el.href='javascript:;';
}
window.onload=function(){
var l=document.getElementsByTagName('a');
for(var i=0;i<l.length;i++){
if(l[i].getAttribute('rel')=='external')
addEvent(l[i], 'click', ventana, false);
}
}
</script>
</head>
<body>
<p><a href="http://www.google.com" rel="external">Google afuera</a></p>
<p><a href="http://yahoo.com">Yahoo dentro</a></p>
<p><a href="http://www.forosdelweb.com" rel="external">Foros del web fuera</a> </p>
</body>
</html>