You can use property "cancelBubble" to stop propagating the event to parent layer. I made sample with two layers with different border. This solution works on IE, FFox, Opera, Safari. don't use "window.event" as this is not recognised by FFox. Here it is :
<html>
<head>
</head>
<body>
<div onclick="alert('outer');" style="border:1px solid red;">
<div onclick="event.cancelBubble = true; return false;"
style="border:1px solid green;margin:10px;">
Don't goToURL() on onClick
</div>
</div>
</body>
</html>