When writing content for your site you might want to give some tips or explanations 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.
Cut and Paste Code
Cut 'n' paste code for the above Example
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 place 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.