In order to prevent the link executing, one way is to let the "onclick" method return false
.
For example:
<a href="http://..." onclick="return clickfunc()">...</a>
If clickfunc()
returns false
, a click on the link will not direct to "http://..."
Although you are probably handling it more like
<a href="http://..." id="somebutton">...</a>
<script>
document.getElementById('somebutton').onclick = function() {
...
else { return false; }
};
</script>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…