Can I assign a hyperlink to an image loaded/positioned through a div tag?

I've created menu icons to run along the top of my website that I want to assign hyperlinks to.  In my index.php file I have <div id="div_home> to reference the follwoing from my css file.  How do I assign a hyperlink to this image?  Or, how do I assign positioning to the icon?  I can create a hyperlink to text and load an image with a hyperlink, but I don't know how to assign absolute positioning when doing this so I did it through the css file.  Help either way is appreciated.

#div_home{
position:relative;
top:6px;
left:14px;
height:78px;
width:40px;
display:block;
background-image:url(../images/Home.png);
background-repeat:no-repeat;
}
vsllcAsked:
Who is Participating?
 
OnthraxCommented:
you can attach an onclick event to the div itself.

You can already do this when craeting the html like this:

<div id="div_home" onclick="document.location='http://www.google.nl'"></div>

or do this through a bit of javascript like this:

document.getElementById("div_home").onclick = "document.location='http://www.google.nl'"

Hope this helps :)
0
 
vsllcAuthor Commented:
Thanks.  It works great.

One more quick question, is there a way to get the mouse to change from a pointer to hand when you scroll over the button?
0
 
OnthraxCommented:
Yes.. you can do this with the style element cursor.

e.g. style='cursor:pointer'

Hope this helps
0
 
vsllcAuthor Commented:
Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.