There are many ways to call a JavaScript function in an HTML document. One way is inside an anchor tag. Any function that is listed in the <HEAD> portion of the document can be called within an anchor, and the anchor tag can refer to either text or an image.
<HTML>
<HEAD>
<SCRIPT language="JavaScript">
function anchor_test() {
window.alert("This is an anchor test.")
}
</SCRIPT>
</HEAD>
<BODY>
<A HREF="javascript:anchor_test()">Test</a>
</BODY>
</HTML>
This technique doesn't rely on any event handlers such as onMouseover or onClick, which may behave differently in different browsers and browser versions.