tags:

views:

39

answers:

2

I wanted to create a box that you could click on and be forwarded to "#" so I thought this would be a good idea:

But unfortuneatly areamaps couldn't be used in div or p tags :/ Anyone have an idea what a good solution would be?

A: 

This is not php related, because its happening in the navigator. Use javascript instead :

<div style='background:url(image.jpg)' onclick='function(){document.location.replace="#"}'> </div>
bPizzi
This work for entire div not for specified area :(
Gugu
It wasn't clear you wanted to match an area.I still think javascript is your solution.One raw method would be to check the mouse position of the cursor in the anonym function matched to the onclick.event.Javascript/jQuery has a function to retrieve the cursor position, see http://docs.jquery.com/Tutorials:Mouse_Position.Again, you can check the real position of your div, therefore you have the position of your bg image.At last just do two lines of maths with a if(), to check if your cursor is within your bg image and to redirect if it is.
bPizzi
it works thanks :)
Gugu
My pleasure :))
bPizzi
A: 

You could create tags inside the div. you give the tag an id. Than you create a style for the tag in you css-file. Set display:block and position the link via position:absolute or position:relative. Set width and height as appropriate.

JanD