473,473 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

tooltip alignment help

omerbutt
638 Contributor
hi there i have tried to make my own AJAX tooltip it works all right and every things fine and the tooltip display right under the element i want to display untill unless i switch my resolution, it shifts from it correct position i am setting its
x and y position i havent done it before , always used the prototypes for such things ,here is my code snippet
Expand|Select|Wrap|Line Numbers
  1.     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3.     <head>
  4.         <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" />
  5.         <title><?=SITE_TITLE;?></title>
  6. <style type="text/css">
  7. .popup {
  8.     position:absolute;
  9.     visibility:hidden;
  10. }
  11. </style>
  12. <script type="text/javascript">
  13. function putIF(hldr,x,y,w,h,url){// description of the arguments below
  14.         if(prevTip!=url){
  15.            holder=document.getElementById(hldr); //wrap around div
  16.            holder.innerHTML="";
  17.            holder.style.visibility='visible';
  18.            holder.style.display='block';  // the div gets styled
  19.            holder.style.position='absolute';
  20.            holder.style.left=x;
  21.            holder.style.top=y;
  22.            holder.style.width=w;
  23.            var page="tooltip_new.php?item_name="+url;
  24.            xmlTip=GetXmlHttpObject();
  25.            if(xmlTip==null){
  26.                 msg_divs('error','400px','780px','400px','400px',"You Have to upgrade the browser");
  27.                return;
  28.            }else{
  29.                 xmlTip.onreadystatechange=$_tip;
  30.                 xmlTip.open("GET",page,true);
  31.                 xmlTip.send(null);
  32.            }
  33.        }
  34.        prevTip=url;
  35.     }
  36.     function $_tip(){
  37.         if(xmlTip.readyState==4){
  38.             if(xmlTip.status==200){
  39.         document.getElementById("tip").innerHTML=xmlTip.responseText;;
  40.             }
  41.         }
  42.     }
  43.     function closeIF(obj){// the close is simple we just clear out the div
  44.         document.getElementById(obj).innerHTML='';
  45.         holder.style.visibility='hidden';
  46.         holder.style.display='none';
  47.         prevTip="";
  48.        }
  49. </script>
  50. </head>
  51. <body>
  52. <tr>
  53.      <td align="left" valign="top" width="727">
  54.       <div id="AddOn_div">
  55.          <table cellspacing="0" cellpadding="0" border="0" align="left" width="727">
  56.                 <tr>
  57.                   <td align="left" valign="top" width="9"></td>
  58.                   <td align="left" valign="top" width="133">
  59.                       <div  id="ahsi_div" onmouseover="putIF('tip','210px','780px','400px','400px','AHSI');" onmouseout="closeIF('tip');">
  60. <img id="ahsi" name="off" src="images/ahsi_off.gif" width="133" height="60" border="0" alt="" onclick="AddOnFor(this.id,0,12);" style="cursor:pointer;" />
  61.                      </div>
  62.                 </td>
  63.                  <td align="left" valign="top" width="9"></td>
  64.                  <td align="left" valign="top" width="133">
  65.                     <div id="pu-nc_wrap_div" onmouseover="putIF('tip','350px','780px','400px','400px','PUNC');" onmouseout="closeIF('tip');"><img id="pu-nc_wrap" name="off" src="images/pu-nc_wrap_off.gif" width="133" height="60" border="0" alt="" onclick="AddOnFor(this.id,0,8);" style="cursor:pointer;" />
  66.                    </div>
  67.                </td>
  68.                <td align="left" valign="top" width="9"></td>
  69.                <td align="left" valign="top" width="133">
  70.                    <div id="omega_div" onmouseover="putIF('tip','495px','780px','400px','400px','OMEGA');" onmouseout="closeIF('tip');">
  71. <img id="omega" name="off" src="images/omega_off.gif" width="133" height="60" border="0" alt="" onclick="AddOnFor(this.id,0,15);" style="cursor:pointer;" />
  72.                   </div>
  73.             </td>
  74.             <td align="left" valign="top" width="9"></td>
  75.             <td align="left" valign="top" width="133">
  76.                <div id="cr_39_div" onmouseover="putIF('tip','635px','780px','400px','400px','CR-39');" onmouseout="closeIF('tip');">
  77. <img id="cr_39" name="off" src="images/cr_39_off.gif" width="133" height="60" border="0" alt="" onclick="AddOnFor(this.id,0,14);" style="cursor:pointer;" />
  78.               </div>
  79.            </td>
  80.            <td align="left" valign="top" width="9"></td>
  81.            <td align="left" valign="top" width="133">
  82.                <div id="quadcore_div" onmouseover="putIF('tip','635px','780px','400px','400px','CR-39');" onmouseout="closeIF('tip');">
  83. <img id="quadcore" name="off" src="images/quadcore_off.gif" width="133" height="60" border="0" alt="" onclick="AddOnFor(this.id,0,17);" style="cursor:pointer;" />
  84.               </div>
  85.           </td>
  86.           <td align="left" valign="top" width="11">
  87.              <img src="images/submitdesign_27.gif" width="11" height="60" border="0" alt="" />
  88.          </td>
  89. </tr>
  90. </table>
  91. </div>
  92. </td>
  93. </tr>
  94. <div id="tip" class="popup" style="width:324px;"></div>
  95. </body>
  96.  

file_name=tooltip_new.php(the file from where the toltip text is responsed)

Expand|Select|Wrap|Line Numbers
  1. <?
  2.     include("includes/config.php");
  3.     $item=$_GET["item_name"];
  4.     $sql_tip="SELECT
  5.                     item_text,item_name,item_heading
  6.                 FROM
  7.                     myrage_tooltip
  8.                 WHERE(myrage_tooltip.item_name ='$item')";
  9.     $res_tip=mysql_query($sql_tip)or die(mysql_error()."<br />".$sql_tip);
  10.     if(mysql_num_rows($res_tip)){
  11.         $f=mysql_fetch_array($res_tip);
  12.     }
  13. ?>
  14. <link rel="stylesheet" type="text/css" href="includes/styles.css"/>
  15. <table cellspacing="0" cellpadding="0" border="0" align="center" width="324">
  16.     <tr><td align="center" valign="top"><img src="images/tooltip_anchor.gif" width="15" height="8" border="0" alt="" /></td></tr>
  17.     <tr><td align="center" valign="middle" style="background-image:url(images/tooltip_head.gif);" class="text_greyblack_12"><?=$f["item_heading"];?></td></tr>
  18.     <tr><td align="center" valign="bottom" style="background-color:#FFB100;"><img src="images/tooltip_border.gif" width="300" height="2" border="0" alt="" /></td></tr>
  19.     <tr>
  20.         <td align="center" valign="bottom" width="324">
  21.             <table cellpadding="0" cellpadding="0" align="center" width="324" border="0" style="background-color:#FFB100; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; color:#000000; text-align:center;">
  22.                 <tr><td align="center" valign="middle">&nbsp;</tr>
  23.                 <tr><td align="center" valign="middle" width="300"><?=$f["item_text"];?></td></tr>
  24.             </table>
  25.         </td>
  26.     </tr>
  27.     <tr><td align="center" valign="middle"><img src="images/tooltip_bottom.gif" width="324" height="14" border="0" align="" /></td></tr>
  28. </table>
  29.  
Thanks for any help in advance
regards ,
Omer
Jul 28 '08 #1
0 1872

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: ltt19 | last post by:
HI everyone, So, I have many buttons, and all of them must show a tooltip with the same string, except one word, that I must read this owrd from a variable. Although, the "ToolTip on x" property...
0
by: EricL | last post by:
Hello, I have written a Custom Control which inherits from ToolTip and it is an OwnerDraw tooltip. In the Popup event I calculate the size of the tooltip I need to display (rather large...
0
by: EricL | last post by:
Hello, I have written a Custom Control which inherits from ToolTip and it is an OwnerDraw tooltip. In the Popup event I calculate the size of the tooltip I need to display (rather large...
4
by: juergen | last post by:
Hello everyone, I want to display a help text when in help mode in my application. Something like a tooltip. Now my application is a taskbar deskband and so not everything works what normally...
7
exoskeleton
by: exoskeleton | last post by:
hi guys..hope you can help me...my boss want me to edit our website and apply the tooltip thing, i mean the moving tooltip that follows the mouse.. please help...thank you... :(
6
by: john | last post by:
I have the following textbox setup with Text & ToolTip Bindings as follows; I'm using Visual Studio 2008 VB: <asp:TextBox ID="txtDay1" runat="server" Text='<%# Eval("Day1") %>'...
3
omerbutt
by: omerbutt | last post by:
hi there i have downloaded a prototype tooltip from http://www.nickstakenburg.com/projects/prototip/ the logic it uses is to call the script after creating the <div> for example i am using the...
16
by: Charles Law | last post by:
I have to take this personally now. Tooltips have been flakey since the dawn of .NET, but to still have to put up with a disappearing tooltip in VS 2008 is getting beyond a joke. Tooltips have...
5
omerbutt
by: omerbutt | last post by:
hi there i have a link in my pge and on mouseover i want to show the tooltip by getting the coordinates x and y from the screen where the onmouseover event occoured can any one teell me the way to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.