PopText.js
上传用户:yunfeng252
上传日期:2022-07-23
资源大小:12403k
文件大小:3k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <!--
  2. tPopWait=10;
  3. tPopShow=60000;
  4. showPopStep=100;  
  5. popOpacity=100;  
  6. fontco="#000000";
  7. fontfa="Verdana,Arial,Helvetica,sans-serif,宋体";
  8. fontsi="12px";
  9. bgcolor="#FFFFB3";
  10. bordercolor="#000000";
  11. sPop=null;curShow=null;tFadeOut=null;tFadeIn=null;tFadeWaiting=null;  
  12. document.write("<style type='text/css'id='defaultPopStyle'>");  
  13. document.write(".cPopText{background-color:" + bgcolor + ";color:" + fontco + ";font-family:" + fontfa + "; border:1px " + bordercolor + " solid;font-size:" + fontsi + "; padding-right:4px; padding-left:4px; height: 10px; padding-top: 2px; padding-bottom: 2px; filter: Alpha(Opacity=0)}");  
  14. document.write("</style>");  
  15. document.write("<div id='dypopLayer' style='position:absolute;z-index:100;' class='cPopText'></div>");  
  16. function showPopupText(){
  17. var o=event.srcElement;  
  18.  MouseX=event.x;
  19.  MouseY=event.y;
  20.  if(o.alt!=null && o.alt!=""){o.dypop=o.alt;o.alt=""};
  21.         if(o.title!=null && o.title!=""){o.dypop=o.title;o.title=""};
  22.  if(o.dypop!=sPop) {  
  23.    sPop=o.dypop;  
  24.    clearTimeout(curShow);  
  25.    clearTimeout(tFadeOut);  
  26.    clearTimeout(tFadeIn);  
  27.    clearTimeout(tFadeWaiting);   
  28.    if(sPop==null || sPop=="") {  
  29.     dypopLayer.innerHTML="";  
  30.     dypopLayer.style.filter="Alpha()";  
  31.     dypopLayer.filters.Alpha.opacity=0;   
  32.     }  
  33.    else {  
  34.     if(o.dyclass!=null) popStyle=o.dyclass   
  35.      else popStyle="cPopText";  
  36.     curShow=setTimeout("showIt()",tPopWait);  
  37.    }  
  38.      
  39.  }  
  40. }  
  41. function showIt(){  
  42.   dypopLayer.className=popStyle;  
  43.   dypopLayer.innerHTML=sPop;  
  44.   popWidth=dypopLayer.clientWidth;  
  45.   popHeight=dypopLayer.clientHeight;  
  46.   if(MouseX+12+popWidth>document.body.clientWidth) popLeftAdjust=-popWidth-24  
  47.    else popLeftAdjust=0;  
  48.   if(MouseY+12+popHeight>document.body.clientHeight) popTopAdjust=-popHeight-24  
  49.    else popTopAdjust=0;  
  50.   dypopLayer.style.left=MouseX+12+document.body.scrollLeft+popLeftAdjust;  
  51.   dypopLayer.style.top=MouseY+12+document.body.scrollTop+popTopAdjust;  
  52.   dypopLayer.style.filter="Alpha(Opacity=0)";  
  53.   fadeOut();  
  54. }  
  55. function fadeOut(){  
  56.  if(dypopLayer.filters.Alpha.opacity<popOpacity) {  
  57.   dypopLayer.filters.Alpha.opacity+=showPopStep;  
  58.   tFadeOut=setTimeout("fadeOut()",1);  
  59.   }  
  60.   else {  
  61.    dypopLayer.filters.Alpha.opacity=popOpacity;  
  62.    tFadeWaiting=setTimeout("fadeIn()",tPopShow);  
  63.    }  
  64. }  
  65. function fadeIn(){  
  66.  if(dypopLayer.filters.Alpha.opacity>0) {  
  67.   dypopLayer.filters.Alpha.opacity-=1;  
  68.   tFadeIn=setTimeout("fadeIn()",1);  
  69.   }  
  70. }  
  71. document.onmouseover=showPopupText;  
  72. //-->