流行的鼠标悬停效果
2012-12-26 15:58
141 查看
<body>
<DIV id=fontDiv style="POSITION: absolute; Z-IndEX: 1"></DIV>
<SCRIPT language=JavaScript>
<!--
var fcolor = "ffffff";
var backcolor = "#888888";
var textcolor = "#336699";
var border = "1";
var width= "170"
var offsetx = 10;
var offsety = 10;
ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false
if (ie4) {
if (navigator.userAgent.indexOf('MSIE 5')>0) {
ie5 = true;
} else {
ie5 = false; }
} else {
ie5 = false;
}
var x = 0;
var y = 0;
var snow = 0;
var sw = 0;
var cnt = 0;
if ( (ns4) || (ie4) ) {
if (ns4) over = document.fontDiv
if (ie4) over = fontDiv.style
document.onmousemove = mouseMove
if (ns4) document.captureEvents(Event.MOUSEMOVE)
}
function nd() {
if ( cnt >= 1 ) { sw = 0 };
if ( (ns4) || (ie4) ) {
if ( sw == 0 ) {
snow = 0;
hideObject(over);
} else {
cnt++;
}
}
}
function onmover(text) {
txt = "<TABLE WIDTH="+width+" BORDER=0 CELLPADDING="+border+" CELLSPACING=0 BGCOLOR=\""+backcolor+"\"><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR=\""+fcolor+"\"><TR><TD CLASS=P1><FONT FACE=\"宋体\" COLOR=\""+textcolor+"\">"+text+"</FONT></TD></TR></TABLE></TD></TR></TABLE>"
layerWrite(txt);
disp();
}
function disp() {
if ( (ns4) || (ie4) ) {
if (snow == 0) {
moveTo(over,x+offsetx,y+offsety);
showObject(over);
snow = 1;
}
}
}
function mouseMove(e) {
if (ns4) {x=e.pageX; y=e.pageY;}
if (ie4) {x=event.x; y=event.y;}
if (ie5) {x=event.x+document.body.scrollLeft; y=event.y+document.body.scrollTop;}
if (snow) {
moveTo(over,x+offsetx,y+offsety);
}
}
function layerWrite(txt) {
if (ns4) {
document.fontDiv.document.write(txt)
document.fontDiv.document.close()
}
else if (ie4) document.all["fontDiv"].innerHTML = txt
}
function showObject(obj) {
if (ns4) obj.visibility = "show"
else if (ie4) obj.visibility = "visible"
}
function hideObject(obj) {
if (ns4)
obj.visibility = "hide"
else if (ie4)
obj.visibility = "hidden"
}
function moveTo(obj,xL,yL) {
obj.left = xL
obj.top = yL
}
//-->
</SCRIPT>
<INPUT onmouseout="nd();" onmouseover="onmover('您可以看到你十分需要的javascript特效!');" type=button value="鼠标旋停到按钮时的效果">
</body>
<DIV id=fontDiv style="POSITION: absolute; Z-IndEX: 1"></DIV>
<SCRIPT language=JavaScript>
<!--
var fcolor = "ffffff";
var backcolor = "#888888";
var textcolor = "#336699";
var border = "1";
var width= "170"
var offsetx = 10;
var offsety = 10;
ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false
if (ie4) {
if (navigator.userAgent.indexOf('MSIE 5')>0) {
ie5 = true;
} else {
ie5 = false; }
} else {
ie5 = false;
}
var x = 0;
var y = 0;
var snow = 0;
var sw = 0;
var cnt = 0;
if ( (ns4) || (ie4) ) {
if (ns4) over = document.fontDiv
if (ie4) over = fontDiv.style
document.onmousemove = mouseMove
if (ns4) document.captureEvents(Event.MOUSEMOVE)
}
function nd() {
if ( cnt >= 1 ) { sw = 0 };
if ( (ns4) || (ie4) ) {
if ( sw == 0 ) {
snow = 0;
hideObject(over);
} else {
cnt++;
}
}
}
function onmover(text) {
txt = "<TABLE WIDTH="+width+" BORDER=0 CELLPADDING="+border+" CELLSPACING=0 BGCOLOR=\""+backcolor+"\"><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR=\""+fcolor+"\"><TR><TD CLASS=P1><FONT FACE=\"宋体\" COLOR=\""+textcolor+"\">"+text+"</FONT></TD></TR></TABLE></TD></TR></TABLE>"
layerWrite(txt);
disp();
}
function disp() {
if ( (ns4) || (ie4) ) {
if (snow == 0) {
moveTo(over,x+offsetx,y+offsety);
showObject(over);
snow = 1;
}
}
}
function mouseMove(e) {
if (ns4) {x=e.pageX; y=e.pageY;}
if (ie4) {x=event.x; y=event.y;}
if (ie5) {x=event.x+document.body.scrollLeft; y=event.y+document.body.scrollTop;}
if (snow) {
moveTo(over,x+offsetx,y+offsety);
}
}
function layerWrite(txt) {
if (ns4) {
document.fontDiv.document.write(txt)
document.fontDiv.document.close()
}
else if (ie4) document.all["fontDiv"].innerHTML = txt
}
function showObject(obj) {
if (ns4) obj.visibility = "show"
else if (ie4) obj.visibility = "visible"
}
function hideObject(obj) {
if (ns4)
obj.visibility = "hide"
else if (ie4)
obj.visibility = "hidden"
}
function moveTo(obj,xL,yL) {
obj.left = xL
obj.top = yL
}
//-->
</SCRIPT>
<INPUT onmouseout="nd();" onmouseover="onmover('您可以看到你十分需要的javascript特效!');" type=button value="鼠标旋停到按钮时的效果">
</body>
相关文章推荐
- jQuery鼠标悬停文字渐隐渐现动画效果
- jquery鼠标悬停导航下划线滑出效果
- jQuery购物图片中的鼠标悬停显示详细信息效果
- Angular4实现鼠标悬停3d倾斜效果
- bootstrap3.0教程之多种表格效果(条纹状表格、条纹状表格、鼠标悬停等)
- DOM设置表格隔行变色js代码及鼠标悬停在哪行,哪行字体就加粗效果
- 方向感知鼠标悬停效果动画
- C# 鼠标悬停在datagridview的某单元格,显示悬浮框效果
- jQuery实现鼠标悬停3d菜单展开动画效果
- 图片鼠标悬停特效 Adipoli 20多种效果jQuery插件
- 用css实现的鼠标悬停效果
- 鼠标悬停效果
- 多种鼠标悬停效果
- bootstrap 中popover的鼠标悬停下拉菜单效果
- css3鼠标悬停效果
- h5新标签和css3动画制作一个鼠标悬停的动画效果
- js实现文字垂直滚动和鼠标悬停效果
- html a 链接标签title属性换行鼠标悬停提示内容的换行效果
- Jquery鼠标悬停按钮图标动态变化效果
- 鼠标悬停图片增加边框效果(适用多种尺寸图片且保持图片不位移)