Make a linkable div

A div can be made into a link very simple using javascript using this code:


<div onclick="location.href='http://www.domain.com';" style="cursor:pointer;">CLICK ME</div>

Here everything that is inside this div will be clickable and will poing to http://www.domain.com.
Using cursor: pointer dhe mause will change when it is over the div, just like in a real link.

This entry was posted in Web Design. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.