1.js代码
//***********默认设置定义.*********************
tpopwait=50;//停留twait豪秒后显示提示。
tpopshow=5000;//显示tshow豪秒后关闭提示
showpopstep=20;
popopacity=99;
//***************内部变量定义*****************
spop=null;
curshow=null;
tfadeout=null;
tfadein=null;
tfadewaiting=null;
document.write("<style type='text/css' id='defaultpopstyle'>");
document.write(".cpoptext { line-break : normal;word-break : break-all ; background-color: #fefcf3;color:#000000; border: 1px #e7b68c solid;padding-top: 2px; padding-right: 4px; padding-left: 4px; padding-bottom: 2px;font-size: 12px;width:468px; filter: alpha(opacity=0)}");
document.write("</style>");
document.write("<div id='dypoplayer' style='position:absolute;z-index:1000;' class='cpoptext'></div>");
function showpopuptext(){
var o=event.srcelement;
mousex=event.x;
mousey=event.y;
if(o.alt!=null && o.alt!=""){o.dypop=o.alt;o.alt=""};
if(o.title!=null && o.title!=""){o.dypop=o.title;o.title=""};
if(o.dypop!=spop) {
spop=o.dypop;
cleartimeout(curshow);
cleartimeout(tfadeout);
cleartimeout(tfadein);
cleartimeout(tfadewaiting);
if(spop==null || spop=="") {
dypoplayer.innerhtml="";
dypoplayer.style.filter="alpha()";
dypoplayer.filters.alpha.opacity=0;
}
else {
if(o.dyclass!=null) popstyle=o.dyclass
else popstyle="cpoptext";
curshow=settimeout("showit()",tpopwait);
}
}
}
function showit(){
dypoplayer.classname=popstyle;
dypoplayer.innerhtml=spop;
popwidth=dypoplayer.clientwidth;
popheight=dypoplayer.clientheight;
if(mousex+12+popwidth>document.body.clientwidth) popleftadjust=-popwidth-24
else popleftadjust=0;
if(mousey+12+popheight>document.body.clientheight) poptopadjust=-popheight-24
else poptopadjust=0;
dypoplayer.style.left=mousex+12+document.body.scrollleft+popleftadjust;
dypoplayer.style.top=mousey+12+document.body.scrolltop+poptopadjust;
dypoplayer.style.filter="alpha(opacity=0)";
fadeout();
}
function fadeout(){
if(dypoplayer.filters.alpha.opacity<popopacity) {
dypoplayer.filters.alpha.opacity+=showpopstep;
tfadeout=settimeout("fadeout()",1);
}
else {
dypoplayer.filters.alpha.opacity=popopacity;
tfadewaiting=settimeout("fadein()",tpopshow);
}
}
function fadein(){
if(dypoplayer.filters.alpha.opacity>0) {
dypoplayer.filters.alpha.opacity-=1;
tfadein=settimeout("fadein()",1);
}
}
document.onmouseover=showpopuptext;
2.html代码包含js代码即可,使用范例
具体的看移动技术网给出的测试代码。
如对本文有疑问,
点击进行留言回复!!
相关文章:
-
-
如何在jsp界面中插入图片
最近初学java web遇到一个问题,就是在jsp中没法显示图片。在网上搜索了许多内容,基本都是说路径问题,因为刚开始是凭着自己的一点半吊子html经验写的&l...
[阅读全文]
-
-
-
-
-
-
-
js实现tab栏切换效果
本文实例为大家分享了js实现tab栏切换效果的具体代码,供大家参考,具体内容如下效果展示:源码展示:<!doctype html><html&...
[阅读全文]
-
js实现双色球效果
本文实例为大家分享了js实现双色球效果的具体代码,供大家参考,具体内容如下效果展示:源码展示:<!doctype html><html lan...
[阅读全文]
-
js实现3D旋转相册
本文实例为大家分享了js实现3d旋转相册的具体代码,供大家参考,具体内容如下效果展示:使用图片:剩余自己随意 图片大小为133*200代码展示:<!doc...
[阅读全文]
网友评论