I'm working on an assignment where I have to create a link that is set up to take the user to a new webpage, but the instructions tell me to use javascript so that when the user clicks the link and alert window pops up that says "Stop That" and cancels the action of the link. My current javascript displays the alert message, but the link still works if the user clicks "OK." Anyone know how to keep the link from working? I added my javascript and my html for the link below:
JS:
<script type="text/javascript">
function stop_link(node)
{
return alert("Stop That!");
}
</script>
HTML Link:
<a href="index.html" onclick="return stop_link(this);">Do Not Click Here!</a>