Please, I need your help with the code below. I want to add an onclick event for the whole DIV to redirect to the url, but I cannot get around the href included in the child anchor inside the DIV .:
i.e. (The goal is to redirect a click to google.com anywhere in the image or text):
<html> <div onclick="location.href='http://www.google.com'"> <div> <a href="http://en.wikipedia.org/"> <img height="200" width="200" src="http://upload.wikimedia.org/wikipedia/commons/6/63/Wikipedia-logo.png"> </a> Test </div> </div> </html>
This works fine when I use a local url like "file: /// E: /Documents/Blog/Design/Tmp1.html" (I don't know why). Thanks.
Update: I add the idea of ββthis query: I need this for the Index section of my blog, which Blogger builds with the same program as for individual posts. In the index, I want every click in the main Div to be redirected to the message, but inside the message, clicking on the image should go to the href image. My idea was that the onclick event was added dynamically in the DIV for the Index section only.
source share