鼠標文字顯示特效,當鼠標移動到文字上面時,顯示預訂的內(nèi)容
運行效果:鼠標文字顯示特效
代碼如下:
<a href="#" onmouseover = "popup('測試數(shù)據(jù)內(nèi)容','green');" onmouseout="kill();">測試</a>
<DIV ID="dek" CLASS="dek"></DIV>
<SCRIPT TYPE="text/javascript">
Xoffset=-60;
Yoffset= 20;
var nav,old,iex=(document.all),yyy=-1000;
if(navigator.appName=="Netscape"){(document.layers)?nav=true:old=true;}
if(!old){
var skn=(nav)?document.dek:dek.style;
if(nav)document.captureEvents(Event.MOUSEMOVE);
document.onmousemove=get_mouse;
}
function popup(msg,bak){
var content="<TABLE BORDER=0 Bgcolor='red' CELLPADDING='3' CELLSPACING='1' ><TD nowrap "+
"BGCOLOR="+bak+" ALIGN=left class=novdn>"+" "+msg+" "+"</TD></TABLE>";
if(old){alert(msg);return;}
else{yyy=Yoffset;
if(nav){skn.document.write(content);skn.document.close();skn.visibility="visible"}
if(iex){document.all("dek").innerHTML=content;skn.visibility="visible"}
}
}
function get_mouse(e){
var x=(nav)?e.pageX:event.x+document.body.scrollLeft;skn.left=x+Xoffset+50;
var y=(nav)?e.pageY:event.y+document.body.scrollTop;skn.top=y+yyy;
}
function kill(){
if(!old){yyy=-1000;skn.visibility="hidden";}
}
</SCRIPT>
更多信息請查看IT技術(shù)專欄