Coding Tips (JavaScript/CSS/VBA/Win32)

Useful code snippets, tips and some Windows applications
Use ProxyChanger 2.2
to change IE proxy settings

How To Add Tooltips to a Page Element

Tooltips can be added to any page element that support OnMouseOver event. There are many ways to create tooltips on a web page with DHTML. Let's go through the most simple script to create a tooltip. The technique is borrowed from Free.Netartmedia.net site .
  1. Create an empty div element with a ToolTip id within the body tag.
  2. Create the following span element:
    <span onmouseover='javascript:showToolTip(event,"Tooltip test")' onmouseout=javascript:hideToolTip()> Show Tip </span>
  3. Use the following style in the head tag:
    #ToolTip {
      position:absolute;
      visibility:hidden;
      left:0; top:0; z-index:10000;
      background-color:#dee7f7;
      border:1px solid #337;
      width:140px; padding:4px;
      color:#000; font-size:11px; line-height:1.3;
      font-family:verdana;
    }
    	
  4. Use the following JavaScript functions:
    function showToolTip(e,text){
    document.all.ToolTip.innerHTML=  text;
    	ToolTip.style.pixelLeft=(e.x+20+document.body.scrollLeft);
    	ToolTip.style.pixelTop=(e.y+document.body.scrollTop);
    	ToolTip.style.visibility="visible";
    }
    function hideToolTip(){
    	ToolTip.style.visibility="hidden";
    }
    	
See it here:
show tool tip

Another example

The Easiest Toottip

Did you know that you can add a title attribute to almost any HTML tag to display a tooltip.
Try it here:

Just hover a mouse over me

Of course, it is not as customizable as the first example but it's easy.