PDA

View Full Version : Cool DHTML Tooltip II can i have 2 rows?!



svenaldo
04-19-2011, 08:48 AM
1) Script Title: Cool DHTML Tooltip II

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex5/dhtmltooltip2.htm

3) Describe problem: Hi, quick question! does anybody know how to have multiple lines of text in the tooltip.

i.e my tooltip is used for translation so i would want to show two lines in the tooltip. the english word then the spanish translation on the next line eg.

hello
hola

so the input would be something like

[code]<span onmouseout="ddrivetip()" onmouseover="hidedrivetip('hello','hola')">hello</span>[ICODE] or maybe a title then content ... im not sure how to do it successfully?!

thanks to anybody that can help?!!

svenaldo
04-19-2011, 11:41 AM
yey, for the newbie ive done it!!

just change

function ddrivetip(thetext, thecolor, thewidth){
if (ns6||ie){
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
tipobj.innerHTML=thetext
enabletip=true
return false
}

to this

function ddrivetip(thetext, thesecondtext, thecolor, thewidth){
if (ns6||ie){
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
tipobj.innerHTML='<div>'+thetext+'</div>'+'<div>'+thesecondtext+'</div>'
enabletip=true
return false
}

you can add as many as you like! and style them each as they all have their own div. seems to work in all browsers like the original plugin aswell. yippee!

vwphillips
04-19-2011, 01:59 PM
<a href="http://www.yahoo.com" onMouseover="ddrivetip('Visit Yahoo.com/<br>tom<br />****<br />harry')";
onMouseout="hideddrivetip()">Search Engine</a>

svenaldo
04-19-2011, 04:07 PM
Hey thanks for the help. Do you see any problems with what I have done? it seems to work great as i will be inputting a lot of translations.