PDA

View Full Version : Text formating in Cool DHTML Tooltips



jpdavis
02-07-2006, 09:19 PM
Script: Cool DHTML Tooltips
http://www.dynamicdrive.com/dynamicindex5/dhtmltooltip.htm

I may just be missing something simple, but I cannot figure out if it is possible to use a line break in the tooltips text. I'd like to put bullet items in a tool tip and need to make sure each item is on its own line. Also is it possible to do bold text?
thanks

ddadmin
02-08-2006, 11:20 AM
The text for the tooltip can contain HTML, so a simple "<br />" tag should work to add a line break where desired.

jscheuer1
02-08-2006, 11:25 AM
To give you an idea of some of what is possible, cut and paste the following into a page that has the script on it. Important points to note are:

There are no line breaks in the tip content.

Double quotes that normally would be used for attributes (in this case the inline style attribute) are replaced with escaped single quotes.


<br><span style="cursor:default;" onMouseover="ddrivetip('<ul style=\'margin-bottom:0;\'><li>Art Directory Twenty One</li><li>About</li><li>Contact Us</li></ul>', '#EFEFEF', 225)";
onMouseout="hideddrivetip()">Planned Items</span><br>

Even greater flexibility could be obtained by defining your string as a variable in the script and using the variable to reference it.

jscheuer1
02-08-2006, 11:36 AM
To expand upon my closing statement in my previous post in this thread, try this (I've defined the variable at the end of the script, highlighted red):



. . .
tipobj.style.width=''
}
}

document.onmousemove=positiontip

var tipOne='<ul style="margin-bottom:0;margin-top:0;"><li>Art Directory Twenty One</li><li>About</li><li>Contact Us</li></ul>'

</script>

<br><span style="cursor:default;" onMouseover="ddrivetip(tipOne, '#EFEFEF', 225)";
onMouseout="hideddrivetip()">Planned Items</span><br>

jpdavis
02-08-2006, 07:45 PM
Well now I feel dumb. I tried using html code before and got no tooltip at all. I think I must have had a bad character somewhere in the text. Thanks for the help, I'm rolling now!