var a = document.getElementsByTagName('a'); for(var i=0; i<a.length; i++) { a[i].onmouseover = function() { window.location.href = this.href; } }