View Full Version : tooltip position
oztinks
09-24-2002, 02:28 AM
How do I get the tool tip to appear next to the link instead of at the top of the page?
It worked fine until I put it into a table, the problem is on this page
http://au.geocities.com/grenwoodcobs/for.html
glenngv
09-24-2002, 02:47 AM
var xdistance=15 //horizontal distance of cursor position to div/layer tag
var ydistance=10 //vertical distance of cursor position to div/layer tag
var x,y //horizontal and vertical position of cursor, respectively
function handlerMM(e){
x = (document.all) ? document.body.scrollLeft+event.clientX : e.pageX;
y = (document.all) ? document.body.scrollTop+event.clientY : e.pageY;
}
function showtip(current,e,num)
{
leftposition=x+xdistance;
topposition=y+ydistance;
if (document.layers) // Netscape 4.0+
{
theString="<DIV CLASS='ttip'>"+tip[num]+"</DIV>"
document.tooltip.document.write(theString)
document.tooltip.document.close()
document.tooltip.left=leftposition
document.tooltip.top=topposition
document.tooltip.visibility="show"
}
else
if(document.getElementById) // Netscape 6.0+ and Internet Explorer 5.0+
{
elm=document.getElementById("tooltip")
elml=current
elm.innerHTML=tip[num]
elm.style.height=elml.style.height
elm.style.top=leftposition
elm.style.left=topposition
elm.style.visibility = "visible"
}
}
}
if (document.layers) document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = handlerMM;
adjust xdistance and ydistance as desired.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.