Link to home
Create AccountLog in
Avatar of nverfollowtt
nverfollowtt

asked on

Making my page's Background Image clickable. Is this possible?

I want my HTML page to have a tiled background Image, which if clicked redirects to some set link in the Javascript.

However, I also want a content block that is above the background, that is not clickable, since if the user clicked in this content box, they wouldn't be clicking on the bkg image.

Any ideas on how to achieve this?

Thanks
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Try Here
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <title></title>
  </head>
  <body onload="window.backgroundClick=true" 
  onclick="if (window.backgroundClick) location='http://google.com/search?q=background'" 
  style="background-color:green">
<div 
onmouseover="window.backgroundClick=false"
onmouseout="window.backgroundClick=true"
onclick="location='http://google.com/search?q=div'" 
 style="position:absolute; width:200px; height:200px; background-color:red">Hello</div>
  </body>
</html>

Open in new window

Avatar of nverfollowtt
nverfollowtt

ASKER

Hey mplungjan that is all inline controls, any way to do this with strickly a JS include?
ASKER CERTIFIED SOLUTION
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer