<SCRIPT language="Javascript">
function hello() {
alert("Hello");
}
</SCRIPT>
<a href="http://www.example.com" onclick="hello();">Go </a>
This is what I want:
When an user click on “Go”, then appear the alert message but the user remains on the same page. With the code above this doesn’t work. How can I do that ?
You need to make the function
return false;to prevent the link from being followed.