Javascript Tooltips, Popups, Captions - BoxOver  

Go Back   Javascript Tooltips, Popups, Captions - BoxOver > Javascript > General
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
  #1  
Old 09-05-2006, 10:55 AM
listedabive listedabive is offline
Junior Member
 
Join Date: Sep 2006
Posts: 2
Default How to setup a tooltip "on the fly"

I'm hoping the BoxOver tool already has this functionality but I'm just not sure how to do it.

Rather than boring you with the specifics of my project here is a similar example on a TV Guide site:

http://www.mydigiguide.com/dgx/wbl.d...37&dt=44fd0450

As you can imagine, if they loaded all the descriptions at design time it would make a massive html page and would take forever to open the page. So when you hover over a cell it sets the tooltip there and then (presumably using Ajax to get the text).

Without using boxover I can achieve this using the following simplified example:


Code:
<div onmouseover="ChangeTooltip();" ID="DIV1" title="Original Tooltip">
and the Javascript function:


Code:
function ChangeTooltip() { //Change Tooltip of DIV1 to "Changed Tooltip" elem = document.getElementById('DIV1'); elem.title = "Changed Tooltip"; }
So the Tooltip will display "Changed" rather than "Original". This, however, doesn't seem to work with BoxOver.

Can it be done? I'm sure there are many uses for it? This may even the same question as already posted here:

http://boxover.swazz.org/forum/want-...ip-t256-1.html
Reply With Quote
  #2  
Old 09-05-2006, 03:07 PM
listedabive listedabive is offline
Junior Member
 
Join Date: Sep 2006
Posts: 2
Default

It's okay guys. I've got it working. If anyone's interested here's how it's done.

The title needs to be a dummy BoxOver title. The flag is just so we only assign the new tooltip once.

Code:
<div onmouseover="ChangeTooltip();" ID="DIV1" title="header=[-] body=[-]" flag="0">
Then in the Javascript function we change the Title and then by resetting the hasbox we force it to be updated.

Code:
function ChangeTooltip() { //Change Tooltip of DIV1 to "Changed Tooltip" elem = document.getElementById('DIV1'); if (elem.flag=="0") { elem.title = "header=[Changed Tooltip] body=[Some text]"; elem.hasbox = 0; elem.flag = "1"; { }
There might be a better way but this certainly does the trick.

Great tool by the way. Much appreciated.

Last edited by listedabive : 09-05-2006 at 06:03 PM.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 06:20 AM.