Just attach both listeners to the div
, and in onkeydown
check the pressed key:
<div
onkeydown="if(event.which===32||event.which===13) location.href='newurl.html';"
onclick="location.href='newurl.html';"
tabindex="0"
>
<a>Islam</a>
</div>