You can do it like this
<a id="a3" href="http://stackoverflow.com" onclick="a(this);">Link3</a>
<a id="a4" href="http://google.com" onclick="a(this);">Link4</a>
<a id="a5" href="http://wikipedia.org" onclick="a(this);">Link5</a>
<script>
function a(t) {
var href = t.getAttribute("href");
if(href==null || href=="") return;
window.open(href,'_blank');
t.removeAttribute("href");
}
</script>