鼠标文字显示特效,当鼠标移动到文字上面时,显示预订的内容
运行效果:鼠标文字显示特效
代码如下:
<a href="#" onmouseover = "popup('测试数据内容','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技术专栏