How to have an element invoke a JavaScript on selection, instead of going to a new URL

Q

How to have an element invoke a JavaScript on selection, instead of going to a new URL

✍: Guest

A

<script type="text/javascript">
function pseudoHitMe() {
alert("Ouch!");
}
</script>
<a href="/javascript:pseudoHitMe()">hit me</a>

2008-12-30, 4116👍, 0💬