Tooltip using javascript and html on hover

fatsaaktif

New Member
JS function:\[code\]function DisplayToolTip() { document.getElementById('divToolTip').style.left = window.event.x; document.getElementById('divToolTip').style.top = window.event.y; document.getElementById('divToolTip').style.visibility = 'visible';}function HideToolTip() { document.getElementById('divToolTip').style.visibility = 'hidden';}\[/code\]HTML: \[code\]<span id="spanName" style="font-weight: bold;border: solid 2px red;" onmouseover="javascript:DisplayToolTip();" onmouseout="javascript:HideToolTip();"> THIS IS THE SPAN</span><div id="divToolTip" style="position: absolute; visibility: hidden; z-index: 20; background-color: white; border: solid 1px Blue;"> This is ToolTip Text</div>\[/code\]With this I got a JS error that is \[code\]window.event.x is not defined\[/code\]. Can anyone help me solve this problem?
 
Back
Top