I'm trying to find the absolute Left and Top of an Element so that I can display a Tooltip, but so far I'm just getting relative values. I'm trying:
I'm struggling to find a Javascript method to do this... can anyone point me in the right direction pls?
Max Hugen
Australia
Code:
function showtip(current,e,num) {
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=e.pageX+14+'px'
document.tooltip.top=e.pageY+2+'px'
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.left=parseInt(elml.left+elml.width+14)+'px'
elm.style.top=parseInt(elml.top+2)+'px'
elm.style.visibility = "visible"
}
}
}
I'm struggling to find a Javascript method to do this... can anyone point me in the right direction pls?
Max Hugen
Australia