SiteExperts.com Logo Home | Community | Developer's Paradise | Jobs
User Groups | Site Tools | Site Information | Search

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.

  1. Define the style for the hot-spot:
    .hotspot {cursor: hand; color: #FF0000; font-weight: bold}
  2. Trap the onselectstart event to prevent a selection of hot spot elements.
    
     function doSelectStart() {
      return ("hotspot"!=event.srcElement.className) 
     }
    
    
     document.onselectstart = doSelectStart;
  3. Demonstration

    Click Me

      <P CLASS="hotspot" ONCLICK="alert('You clicked me!')"> 
        Click Me
      </P>
Discuss and Rate this Article