Using Functions as Event Handlers : Hyper Link Event « Event « JavaScript DHTML






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

1.Using onMouseOver and onMouseOut Event Handlers
2.Handling onClick or Links
3.Handling onMouseOut or Links
4.Using the Event Object with Navigator and Internet Explorer
5.Using the const Keyword
6.Using onClick and onDblClick Event Handlers