TOOLTIP UTILITY

This javascript will help you to build tooltip for a link / button in a webpage as you wish. A "tooltip" is the small yellow box that appears when you hover over an object on your screen. It works in Internet Explorer, Opera, and Netscape 6.

Features

  • You can build many of tooltips for the same webpage.
  • You can get the tooltip information using this javascript function.
  • Simple and ease of use.
  • Just download the image, copy the code in to your page and use it.

Preview

Just move your mouse cursor over the button or image.


LINK

Downloads

CSS CODE
<style type = "text/css">
#bubble_tooltip{
width:210px;
position:absolute;
display: none;
}
#bubble_tooltip .bubble_top{
position:relative;
background-image: url(htooltip/bubble_top.gif);
background-repeat:no-repeat;
height:18px;
}
#bubble_tooltip .bubble_middle{
position:relative;
background-image: url(htooltip/bubble_middle.gif);
background-repeat: repeat-y;
background-position: bottom left;
}
#bubble_tooltip .bubble_middle div{
padding-left: 12px;
padding-right: 20px;
position:relative;
font-size: 11px;
font-family: arial, verdana, san-serif;
text-decoration: none;
color: red;
text-align:justify;
}
#bubble_tooltip .bubble_bottom{
background-image: url(htooltip/bubble_bottom.gif);
background-repeat:no-repeat;
height:65px;
position:relative;
top: 0px;
}
</style>
<!-- Script by hscripts.com -->


HTML Code

<!-- Script by hscripts.com -->
<table id="bubble_tooltip" border=0 cellpadding=0 cellspacing=0>
<tr class="bubble_top"><td></td></tr>
<tr class="bubble_middle"><td><div id="bubble_tooltip_content"></div></td></tr>
<tr class="bubble_bottom"><td colspan=5></td></tr>
</table>
Just move your mouse cursor over the button or image.<br><br>
<input type="button" id="b1" value="BUTTON" onmouseover="showToolTip(event,text1)" onmouseout="hideToolTip()"></input>
<br><br>
<a href="#" onmouseover="showToolTip(event,text2)" onmouseout="hideToolTip()"> LINK </a>
<!-- Script by hscripts.com -->

Javascript Code


<script type="text/javascript">
var text1="The tooltip is an easy way of interaction for the visitors in a web page ";
var text2="For webhosting, please contact us at support@hiox.com";
//This is the text to be displayed on the tooltip.
if(document.images){
pic1= new Image();
pic1.src='htooltip/bubble_top.gif';
pic2= new Image();
pic2.src='htooltip/bubble_middle.gif';
pic3= new Image();
pic3.src='htooltip/bubble_bottom.gif';
}
function showToolTip(e,text){
if(document.all)e = event;
var obj = document.getElementById('bubble_tooltip');
var obj2 = document.getElementById('bubble_tooltip_content');
obj2.innerHTML = text;
obj.style.display = 'block';
var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
if(navigator.userAgent.toLowerCase().indexOf('safari')>=0)st=0;
var leftPos = e.clientX-2;
if(leftPos<0)leftPos = 0;
obj.style.left = leftPos + 'px';
obj.style.top = e.clientY-obj.offsetHeight+2+st+ 'px';
}
function hideToolTip()
{
document.getElementById('bubble_tooltip').style.display = 'none';
}
</script>
<!-- Script by hscripts.com -->
  • Release Date - 23-12-2007
  • Downloads : Version 1.0 - Tooltip-Images.zip
  • Get free version without ©copyright link for just $10/-
  • For customization of this script or any script development, mail to support@hscripts.com

Usage

    How to use tooltip?
  • Unzip the download
  • You will get the images used in this javascript and if you want to use this images then include the following line,
  •  pic1.src='htooltip/bubble_top.gif';
     pic2.src='htooltip/bubble_middle.gif';
     pic3.src='htooltip/bubble_bottom.gif';
  • If you want to change the message then add your Message in Javascript code
  •  var text1 = "Your tooltip Message";
     var text2 = "Your tooltip Message";
    You can add as many messages as your wish.
  • Html content
  • <input type="button" id="b1" value="Button" onmouseover="showToolTip(event,text1)" onmouseout="hideToolTip()">
        <a href="#" onmouseover="showToolTip(event,text2)" onmouseout="hideToolTip()">LINK</a>
  • Your message is passed as argument for the javascript function showtooltip(event,text1)
  • When the mouse is pointed over the button or link, the function showtooltip(event,text) is triggered and the tooltip is displayed.
  • When the mouse is taken out,the function hidetooltip() is triggered and hides the tooltips.
  • Copy the code into your page and use the script.

License

Related Scripts

Free Javascript Scripts


Ask Questions

Ask Question