You are here: irt.org | FAQ | JavaScript | DHTML | Q1484 [ previous next ]
Try:
<html> <head> <script language="JavaScript"><!-- IE=(document.all)?1:0; NS=(document.layers)?1:0; if (!IE && !NS) { /* Dummy event var for v3 browsers. I use eval because IE will not allow event to be assigned directly even within the if! */ eval('event = ""'); } function toolTip(e,msg,on) { if (!IE && !NS) { if (!msg) msg = ''; window.status = msg; return true; } if (IE && window.event.srcElement.title == '') window.event.srcElement.title = msg; else if (NS) { if (on) { document.layers["tooltip"].document.write('<table border=1><tr><td>'+msg+'</td></tr></table>'); document.layers["tooltip"].document.close(); document.layers["tooltip"].top = e.pageY+15; document.layers["tooltip"].left= e.pageX; document.layers["tooltip"].visibility="show"; } else document.layers["tooltip"].visibility="hide"; } return true; } //--></script> </head> <body> <a href="javascript:;" onMouseOver="return toolTip(event,'Hello\nThere',1)" onMouseOut="return toolTip()">Hello</a> <a href="javascript:;" onMouseOver="return toolTip(event,'Goodbye',1)" onMouseOut="return toolTip()">Goodbye</a> <layer name="tooltip" bgcolor="#FFFFCC" visibility="hide"></layer> </body> </html>