Possible Duplicate:
How can I stop an onclick event from firing for parent element when child is clicked?
I have a div with an onClick event but I don’t want it to run when I click a link inside the div.
How can I stop the onClick effecting links inside the element?
<div onclick="dosomething();">
<a href="mylink.com">go somewhere but don't dosomething();</a>
</div>
If you could use jQuery then,
$(document).ready(function() { $("#yourDivId a").click(function(e) { e.preventDefault(); }); }); //OR without jQuery document.getElementById("yourAnchorId").onclick = function(evt) { evt.stopPropagation(); //for IE window.event.cancelBubble = true }Hope it helps