How to dynamically set position for a component

How to dynamically set position for a component

I am trying to build this interface where there are icons and onmouseover, it displays menu choices for the corresponding. Instead of fixing the position of the menu box, is there a way to specify the left and top of that, relative to the icon that is being hovered? Here is part of my code:
  1. <table width="100%" style="">
  2.        <tr align="center">
  3.            <td>
  4.                <img id="imgHead1" src="images/ccd.ico" alt="Info Center" style="position:relative; border:1px solid black;" />
  5.                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  6.                <img id="imgHead2" src="images/back_label.gif" alt="Reports" style="position:relative;" />
  7.            </td>
  8.            <td>
  9.                
  10.            </td>
  11.        </tr>
  12.        <tr align="center">
  13.            <td>
  14.                <div id="imgH1div1" style="width:200px; height:50px;margin: 0px 0 0 0px; 
  15.                    border:1px solid gray; padding:20px; position:relative;left:98px;" >
  16.                    <a href="http://www.ccdsystems.com" ><img id="imgH1image1" src="images/B1.gif" alt="Create Event" /></a>
  17.                    <img id="imgH1image2" src="images/btnAdd.gif" alt="Remove Event" />
  18.                </div>
  19.                 
  20.                <div id="imgH2div1" style="width:200px; height:50px;margin: 0px 0 0 0px; 
  21.                    border:1px solid gray; padding:20px;position:relative;left:170px;" >
  22.                    <img id="imgH2image1" src="images/Chart_Pie.gif" alt="Create Event" />
  23.                    <img id="imgH2image2" src="images/Close_Button.gif" alt="Create Event" />
  24.                </div>
  25.            </td>
  26.        </tr>
  27. </table>
Thanks.