Tip Boxes
When writing content for your site you might want to give some tips or explainations for particular words or phrases. For this you might consider using DHTML Tip boxes that appear when a link is rolled over. The following example shows how you can do this.

Example of a link Tip Box

Rollover the link to see the Tip Box

Cut 'n' paste code for the above Example

Java-script Code

HTML Code

Instructions

Make a transparent gif called shim under your images folder as 'div' tag layers need an image to be present to work in Netscape plus we need it as a place holder (usually following the link) to show where the tip box should appear. If you are trying to use multiple tip boxes then you need to change the name of the respective div layer id field and also change the reference to it in the link onMouseOver event for the respective boxes. Also give the image place holder (here the shim image named imgDel) a new name property for each tip box and change the reference to it in the link onMouseOver event for the respective boxes.

Explanation of the Code

The java-script has the following main functions:

  • function showTipBox is used to make the tip box appear: This function first finds the top and left position of the place holder shim image (usually placed following the link) by its name passed to it while calling the function in the link onMouseOver event. Next it shows the div tag layer by the layer name passed to it by setting its visiblity property (to 'show' in Netscape and 'visible' in IE) and places it in the position of the place holder image.
  • function linkTimer is called to hide the tip box on the onMouseOut event after a small pause: This function waits for a small time period (here 500 milliseconds i.e. 1/2 a second) and then calls the hideLayer function (it passes the visible layer name).
  • function hideLayer is used to hide the visible tip box by setting the visibility property of the layer to 'hide' in Netscape and 'hidden' in IE.

I hope this came in useful!


Close    To Top
  • Prev Article-Web Design:
  • Next Article-Web Design:
  • Now: Tutorial for Web and Software Design > Web Design > JavaScript > Web Design Content
    Photoshop Tutorial
     

    Special Effect

      3D Effect
      Photoshop Articles
    Programming Tutorial
     

    C/C++ Tutorial

      Visual Basic
      C# Tutorial
    Database Tutorial
     

    MySQL Tutorial

      MS SQL Tutorial
      Oracle Tutorial
    Geek Tutorial
     

    Blogging Tutorial

      RSS Tutorial
      Podcasting Tutorial
    Graphic Design Tutorial
      Coreldraw Tutorial
      Illustrator Tutorial
      3D Tutorials
    Webmaster Articles
     

    Domain Service

      Web Hosting
      Site Promotion
    Java Tutorial/ Articles
     

    Java Servlets

      JavaEE Tutorial
     

    JavaBeans Tutorial

    XML Tutorial/ Articles
     

    XML Style

      AJAX Tutorial
      XML Mobile
    Flash Tutorial/ Articles
     

    Flash Video

      Action Script
      Flash Articles
    OS Tutorial/ Articles
      Linux Tutorial
      Symbian Tutorial
      MacOS Tutorial
    Personal Tech
      Hardware Tutorial
      Software Tutorial
      Online Auction