I have a code like this:
<a href="somewhere.html">
<img src="blabla">
<div class="wrap">
<div id="id1" onclick="window.location = 'somepage1.html';"></div>
<div id="id2" onclick="window.location = 'somepage2.html';"></div>
<div>
</a>
The problem is that the div’s onclick is not working. When I click on div’s I go to somewhere.html.
You have wrong html structure wrapping divs inside link (unless using html5):
When you click, you will always go to link at top
somewhere.htmland inner divs won’t do what you want to do. You should modify your html structure.