 Inside Technique : Hot Spots By Scott Isaacs
With Dynamic HTML, you can make the text of any element a place to click on. However, without a little bit of work, your users are not going to know where to click.
This article demonstrates a very simple two-step solution that can make any element feel like an anchor.
- Define the style for the hot-spot:
.hotspot {cursor: hand; color: #FF0000; font-weight: bold}
- Trap the onselectstart event to prevent a selection of hot spot elements.
function doSelectStart() {
return ("hotspot"!=event.srcElement.className)
}
document.onselectstart = doSelectStart;
Demonstration
Click Me
<P CLASS="hotspot" ONCLICK="alert('You clicked me!')">
Click Me
</P>
Discuss and Rate this Article© 1997-2000 InsideDHTML.com, LLC. All rights reserved. |