I found that onclick function must return false for proceeding with href value and true for blocking the same . I used the same here too . on returning false , it is right , proceeding with URL but on returning true , it is also opening the URL page .
So what is different between returning true / false value from onclick function .
I am using Firefox 9.0.1 and IE 7 . . Following is my html file .
<html>
<head>
<script language="JavaScript" type="text/javascript">
function clickthis()
{
alert("its onclick Function call ");
return true;
}
</script>
</head>
<body >
<a id="foo" onclick="clickthis();" href="http://google.com">google</a>
</body>
</html>
I got confused with this behaviour .
The event handler needs to return
falseto prevent normal link action, and it is not suffient to just call a function; the handler itself needs to return the valuefalseif you wish to suppress the action. So the attribute should be