<a id="alert" href="/news" onclick="alert('Заранее спасибо)');">link</a
document.getElementById('alert').href = '';
<a id="alert" href="/news" onclick="testFunction(this);">link</a> <script> function testFunction(el){ alert(1); el.preventDefault(); } </script>
var event = event || window.event; event.preventDefault ? event.preventDefault() : event.returnValue = false;