-1

I have put a banner at the top of my website and I have tried to add a hyperlink to the whole div as follows:

<div id="banner" onclick="location.href='http://www.heavenlygardens.org.uk/';" style="cursor: pointer;">

It doesn't work but you can see it here: http://www.heavenlygardens.org.uk/maps/6/index3_new.html

Any ideas?

Daniish
  • 27
  • 6
  • Youre missing the javascript: http://stackoverflow.com/a/16572197/7862006 – K. Tromp May 12 '17 at 20:24
  • Some help (like you) have already found a response on this [thread](http://stackoverflow.com/questions/16562577/how-can-i-make-a-button-redirect-my-page-to-another-page). – Dardan Iljazi May 12 '17 at 20:25

2 Answers2

0

To achieve expected result,use below option

1.Stack banner front using z-index:9999

<div id="banner" onclick="location.href='http://www.heavenlygardens.org.uk/';" style="cursor: pointer;z-index:9999">
Naga Sai A
  • 10,771
  • 1
  • 21
  • 40
0

This works for me:

<div onclick="location.href='http://www.google.com/';" style="cursor:pointer;">
    <img src="//path-to-image.jpg" alt="description of image" />
</div>

However, unless you have a good reason for doing this in JavaScript, plain HTML would be a better option.

<a href="http://www.google.com">
   <img src="//path-to-image" alt="description of image"/>
</a>
Josh
  • 3,872
  • 1
  • 12
  • 13