disappear tooltip on mouseout event

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
tanvirtonu
Forum Commoner
Posts: 35
Joined: Wed Oct 17, 2007 9:15 am

disappear tooltip on mouseout event

Post by tanvirtonu »

pickle | Please use [ code=php ], [ code=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: Posting Code in the Forums to learn how to do it too.


Can anybody tell me how to disappear the popup on mouseout event.I tried but failed.It will show a tooltip/popup on mouseover event but is not going away on mouseout event.

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<SCRIPT TYPE="text/javascript">
<!--
Xoffset=-60;    // modify these values to ...
Yoffset= 20;    // change the popup position.
 
var old,skn,iex=(document.all),yyy=-1000;
 
var ns4=document.layers
var ns6=document.getElementById&&!document.all
var ie4=document.all
 
if (ns4)
   skn=document.infobox
else if (ns6)
   skn=document.getElementById("infobox").style
else if (ie4)
   skn=document.all.infobox.style
if(ns4)document.captureEvents(Event.MOUSEMOVE);
else{
   skn.visibility="visible"
   skn.display="none"
}
document.onmousemove=get_mouse;
 
function msgbox(msg,bak) {
   var content="<table width=300 border=1 bordorcolor=black cellpadding=2 cellspacing=0 "+
   "bgcolor="+bak+"><tr align=left><td width=100%><font color=#404040 size=2><b><i>Pack Download Command</i></b></font><br><font color=#404040 size=1>Copy the following text into your clipboard and<br>once in the channel hit CTRL+V to paste it!</font></td></tr><tr align=left><td width=100%><font color=black size=2>"+msg+"</font></td></tr></table>";
   yyy=Yoffset;
    if(ns4){skn.document.write(content);skn.document.close();skn.visibility="visible"}
    if(ns6){document.getElementById("infobox").innerHTML=content;skn.display=''}
    if(ie4){document.all("infobox").innerHTML=content;skn.display=''}
}
 
function get_mouse(e){
   var x=(ns4||ns6)?e.pageX:event.x+document.body.scrollLeft;
   skn.left=x+Xoffset;
   var y=(ns4||ns6)?e.pageY:event.y+document.body.scrollTop;
   skn.top=y+yyy;
}
 
function die(){
   yyy=-1000;
   if(ns4){skn.visibility="hidden";}
   else if (ns6||ie4)
   skn.display="none"
}
 
//-->
</SCRIPT>
</head>
 
<body>
<DIV id="infobox">MOUSE HERE</DIV>
<a href="http://some_link.htm" onmouseover="msgbox('Message Text Here','#E6E6BE')"; onmouseout="die()">Link Text</a>
 
</body>
</html>

pickle | Please use [ code=php ], [ code=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: Posting Code in the Forums to learn how to do it too.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: disappear tooltip on mouseout event

Post by pickle »

Well, if you're not viewing the page in Netscape4 or 6, or IE5, then die() doesn't do anything.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply