DEVFYI - Developer Resource - FYI

how to have an element invoke a javascript on selection, instead of going to a new URL:

JavaScript Interview Questions and Answers


(Continued from previous question...)

79. how to have an element invoke a javascript on selection, instead of going to a new URL:

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

(Continued on next question...)

Other Interview Questions