未登陆则在右下角弹出提示登陆窗口

来源:互联网 发布:win7 for mac 下载 编辑:程序博客网 时间:2024/05/15 00:50

未登陆则在右下角弹出提示登陆窗口

这个页页类似弹出广告,不过不会被3721过滤掉,我给起的名字还是ad.js,放在ad文件夹中


后台风格界面模板总管理Main_Style的Dvbbs.mainhtml(7)的最后加入


<SCRIPT language=javascript src="ad/ad.js"></SCRIPT>
<DIV id=location style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; FILTER: Alpha(Opacity=70); VISIBILITY: hidden; BORDER-LEFT: 1px solid; WIDTH: 220px; BORDER-BOTTOM: 1px solid; POSITION: absolute; TOP: 0px; HEIGHT: 80px; BACKGROUND-COLOR: #E4E8EF">
<TABLE cellSpacing=0 cellPadding=5 width="100%" bgColor=#E4E8EF border=0>
<TBODY><TR><TD>欢迎光临心跳论坛:</TD></TR><TR>
<TD align=middle
                height=90>您还没有注册或登录<BR>请先注册或登录以避免此窗口再次出现<BR><BR><B><A
                href="reg.asp">注册</A>         <A
                href="login.asp">登录</A></B><BR><BR>此视窗10秒后自动关闭<BR></TD></TR></TBODY></TABLE></DIV></TD></TR></TBODY></TABLE>


其中FILTER: Alpha(Opacity=70)参数为透明参数,Opacity的值在0~100之间。


JS文件下载地址:
http://bbs.xintiao.net/ad/ad.js
========================================================

有人说,想把这个框框弄到屏幕中间来,我只给个演示,原创属于雷傲论坛
点击下面的链接来浏览效果,查看源代码就是你所需要的代码了不过,里面我远程调用了雷傲的两个JS文件,需要的话,还需要另行下载

JS文件下载地址
http://bbs.leobbs.com/non-cgi/images/board.js
http://bbs.leobbs.com/non-cgi/images/lbpopup.js

附上ad.js代码:
window.onload = getMsg;
window.onresize = resizeDiv;
window.onerror = function(){}
var sdivTop,sdivLeft,sdivWidth,sdivHeight,sdocHeight,sdocWidth,sobjTimer,i = 0;
function getMsg()
{
try{
sdivTop = parseInt(document.getElementById("location").style.top,10)
sdivLeft = parseInt(document.getElementById("location").style.left,10)
sdivHeight = parseInt(document.getElementById("location").offsetHeight,10)
sdivWidth = parseInt(document.getElementById("location").offsetWidth,10)
sdocWidth = document.body.clientWidth - 20;
sdocHeight = document.body.clientHeight;
document.getElementById("location").style.top = parseInt(document.body.scrollTop,10) + sdocHeight + 10;//    divHeight
document.getElementById("location").style.left = parseInt(document.body.scrollLeft,10) + sdocWidth - sdivWidth
document.getElementById("location").style.visibility="visible"
sobjTimer = window.setInterval("moveDiv()",10)
}
catch(e){}
}

function resizeDiv()
{
i+=1
if(i>500) closeDiv()
try{
sdivHeight = parseInt(document.getElementById("location").offsetHeight,10)
sdivWidth = parseInt(document.getElementById("location").offsetWidth,10)
sdocWidth = document.body.clientWidth;
sdocHeight = document.body.clientHeight;
document.getElementById("location").style.top = sdocHeight - sdivHeight + parseInt(document.body.scrollTop,10)
document.getElementById("location").style.left = sdocWidth - sdivWidth + parseInt(document.body.scrollLeft,10) -20
}
catch(e){}
}

function moveDiv()
{
try
{
if(parseInt(document.getElementById("location").style.top,10) <= (sdocHeight - sdivHeight + parseInt(document.body.scrollTop,10)))
{
window.clearInterval(sobjTimer)
sobjTimer = window.setInterval("resizeDiv()",1)
}
sdivTop = parseInt(document.getElementById("location").style.top,10)
document.getElementById("location").style.top = sdivTop - 1
}
catch(e){}
}
function closeDiv()
{
document.getElementById('location').style.visibility='hidden';
if(sobjTimer) window.clearInterval(sobjTimer)
}