Using Functions as Event Handlers
<HTML>
<HEAD>
<TITLE>Using functions as event handlers</TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
function confirmLink() {
alert("www.java2s.com")
if(confirm("www.java2s.com?")) {
window.location="http://www.java2s.com"
}
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<H1>Using functions as event handlers</H1>
<P><A HREF="somewhere" onClick="return false" onMouseOver="confirmLink()">Confirms
whether you want to connect via this link.</A></P>
</BODY>
</HTML>
Related examples in the same category