944,123 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 3085
  • PHP RSS
Feb 22nd, 2007
0

Tooltips for HTML links

Expand Post »
i'm fascinated by the tooltip or the information bubble , which pops-up on this page when I point my cursor on a thread title.
Does anyone know what it takes to code something like that? Is it possible with PHP, javascript or AJAX ?

The attached image shows the tooltip I'm referring to!
Attached Thumbnails
Click image for larger version

Name:	tt.JPG
Views:	40
Size:	26.6 KB
ID:	2870  
Similar Threads
Reputation Points: 9
Solved Threads: 0
Newbie Poster
madhav_2k is offline Offline
5 posts
since Apr 2006
Feb 22nd, 2007
0

Re: Tooltips for HTML links

Featured Poster
Reputation Points: 1536
Solved Threads: 431
Posting Expert
iamthwee is offline Offline
5,865 posts
since Aug 2005
Feb 18th, 2008
0

Re: Tooltips for HTML links

Hi there,
I read your post about that cool imagetooltip.

Well here is the thing. I have tried it in php page with a static page but what about when you want dynamic content in the tool tip. I mean what If i have 40 products with their images and I want to show them accordingly.

here is some code I tried but it didnt worked.

PHP Syntax (Toggle Plain Text)
  1. mysql_data_seek($result, $i);
  2.  
  3. $newArray = mysql_fetch_assoc($result);
  4.  
  5. $aa = $newArray['aa'];
  6.  
  7. $Model = $newArray['Model'];
  8.  
  9.  
  10. echo "messages[".$aa."] = new Array('".$Model.".pdf','',\"#FFFFFF\");\n";

and then in the actualy product list

PHP Syntax (Toggle Plain Text)
  1. echo " <td align=\"center\" bgcolor=\"#F2F5F7\"><A href=\"javascript:void(window.open('pdf/".$Model.".pdf', '', 'resizable=no,scrollbars=yes,status=yes,width=620,height=750'))\" onmouseover=\"doTooltip(event,".$aa.")\" onmouseout=\"hideTip()\" class=\"style17\">$Model</A></td>\n";

It did worked with one image (always the same but I would like to have a piicture for each different porduct. I have uploaded all products images on server as I did for pdfs.
Thanks in advance

Fotis
Reputation Points: 10
Solved Threads: 0
Newbie Poster
dvsgr is offline Offline
1 posts
since Feb 2008
Feb 19th, 2008
0

Re: Tooltips for HTML links

The way that I personally would be doing this is
setting a "while" statement as my query result which would include what is in your "echo", and then echoing the result in the html body itself.

The while statement itself means that you don't really have to deal with creating and manipulating arrays "by hand" as I like to say. it parses it on it's own, simply by making your final result something like

PHP Syntax (Toggle Plain Text)
  1. $myresult .= "<td align=\"center\" bgcolor=\"#F2F5F7\"><A href=\"javascript:void(window.open('pdf/".$Model.".pdf', '', 'resizable=no,scrollbars=yes,status=yes,width=620,height=750'))\" onmouseover=\"doTooltip(event,".$aa.")\" onmouseout=\"hideTip()\" class=\"style17\">$Model</A></td>\n";

And then, in your html body
PHP Syntax (Toggle Plain Text)
  1. echo $myresult;

The dot before the = is required to make it loop itself (I think).
Reputation Points: 10
Solved Threads: 6
Junior Poster in Training
sagedavis is offline Offline
86 posts
since Nov 2007
Feb 22nd, 2008
0

Re: Tooltips for HTML links

I prefer to use the css version of the tool tip.

PHP Syntax (Toggle Plain Text)
  1. <style type="text/css">
  2. #info p {margin-left:15px; margin-right:20px;}
  3. #info img {margin:15px; float:left;}
  4. #info h1 {margin-left:15px;}
  5. /* the style starts here */
  6. a.tooltip {color:#c00;}
  7. a.tooltip b {display:none;}
  8. a.tooltip:hover {border:0; position:relative; z-index:500; text-decoration:none;}
  9. a.tooltip:hover b {display:block; position:absolute; top:20px; left:-25px; padding:5px; font-weight:normal; color:#000; border:1px solid #888; background:#ffc; width:150px;}
  10. a.tooltip:hover b em {position:absolute; left:20px; top:-6px; width:11px; height:6px; background:#fff url(tooltip.gif) 0 0; display:block; font-size:1px;}
  11. </style>
PHP Syntax (Toggle Plain Text)
  1. <a class="tooltip" href="link or anchor">Display<b><em></em>The text in tool tip</a>

found it at CSS Play
Attached Thumbnails
Click image for larger version

Name:	css-tooltip.jpg
Views:	191
Size:	18.1 KB
ID:	5211  
Reputation Points: 43
Solved Threads: 0
Newbie Poster
squid44th is offline Offline
9 posts
since Feb 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Which one is the Best PHP editor
Next Thread in PHP Forum Timeline: PHP / SQL Delete From Statement Not working with URL?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC