www.gusucode.com > CC校友录贴吧 CCBar源码程序asp编程 > js/pop_win.js
// Description : 弹出式提示窗口 //***********默认设置定义.********************* tPopWait = 0; //停留tWait毫秒后显示提示。 tPopShow = 5000; //显示tShow毫秒后关闭提示 showPopStep = 20; popOpacity = 95; //***************内部变量定义***************** sPop = null; curShow = null; tFadeOut = null; tFadeIn = null; tFadeWaiting = null; document.write("<div id='divPopWin' style='position:absolute;z-index:1000;' ></div>"); function ShowPopWin() { 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 == "") { divPopWin.innerHTML = ""; divPopWin.style.filter = "Alpha()"; divPopWin.filters.Alpha.opacity = 0; } else { if (o.dyclass!=null) popStyle = o.dyclass else popStyle = "list_table"; curShow = setTimeout("ShowIt()",tPopWait); } } } function ShowIt() { divPopWin.className = popStyle; divPopWin.innerHTML = sPop; popWidth = divPopWin.clientWidth; popHeight = divPopWin.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; divPopWin.style.left = MouseX+12+document.body.scrollLeft+popLeftAdjust; divPopWin.style.top = MouseY+12+document.body.scrollTop+popTopAdjust; divPopWin.style.filter = "Alpha(Opacity=0)"; FadeOut(); } function FadeOut() { if (divPopWin.filters.Alpha.opacity < popOpacity) { divPopWin.filters.Alpha.opacity+=showPopStep; tFadeOut = setTimeout("FadeOut()",1); } else { divPopWin.filters.Alpha.opacity = popOpacity; tFadeWaiting = setTimeout("FadeIn()",tPopShow); } } function FadeIn() { if (divPopWin.filters.Alpha.opacity > 0) { divPopWin.filters.Alpha.opacity-=1; tFadeIn = setTimeout("FadeIn()",1); } } document.onmouseover = ShowPopWin;