直接贴代码~
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title> New Document </title> </head> <script> var c$={}; var w$=function(s){document.write(s);} var o$=function(id){return document.getElementById(id);} w$("<div id=\"ts\" style=\"position:absolute;background-color:#FFFFE6;font-size: 12px;padding: 3px; border: 1px solid #FFCC99;display:none\"></div>"); c$.mmove=function(o,s){ //alert(typeof(s)); var evt=event||window.event; var x=evt.clientX+5; var y=evt.clientY+20; o$("ts").style.left=x+"px"; o$("ts").style.top=y+"px"; if(s==""||typeof(s)=="undefined"){ o$("ts").innerHTML=o.innerHTML; }else{ o$("ts").innerHTML=s } o$("ts").style.display=""; } c$.mout=function(){ o$("ts").style.display="none"; } </script> <body> <a href="#" onmousemove="c$.mmove(this,'点击查看设备误差分析');" onmouseout="c$.mout();"> //这是显示悬浮后显示的文字 <span style="color:blue;text-decoration:underline;">分析 </span> //这里是放置鼠标的文字 </a> </body> </html>