November 18, 1999 - Cancelling a Link
![]() |
November 18, 1999 Cancelling a Link Tips: November 1999
Yehuda Shiran, Ph.D.
|
<A HREF="http://www.docjs.com/" onClick="return false">Doc JavaScript</A>
When the user clicks this link (Doc JavaScript), nothing happens. The onClick event handler returns false, so the specified URL isn't loaded. The following link asks the user to confirm the click:
<SCRIPT LANGUAGE="JavaScript">
<!--
function areSure() {
return confirm("Are you sure?");
}
// -->
</SCRIPT>
<A HREF="http://www.docjs.com/" onClick="return areSure()">Doc JavaScript</A>When the user clicks this link (Doc JavaScript) a confirm dialog box pops up. If the user clicks OK, the page http://www.docjs.com/ is loaded. If the Cancel button is pressed, the page isn't loaded.


Find a programming school near you