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>

2011-02-22, 3316👍, 0💬