流浪者家园


标题: 特效实现窗口提示,非对话框,非windows.open
小桂华
家园秀才
Rank: 3Rank: 3



UID 10853
精华 1
积分 348
帖子 131
威望 348 威望值
家园币 4502 家元
现金 600 元
存款 1000 元
阅读权限 30
注册 2006-9-23
状态 离线
 
发表于 2006-11-3 17:52  资料  个人空间  短消息  加为好友 

特效实现窗口提示,非对话框,非windows.open

实现方法是css+javascript,其实说白了和鼠标点击换图片差不多。

将下面代码保存到记事本中,后缀名改为htm。

<SCRIPT language=javascript>
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)
}
</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></TD></TR></TBODY></TABLE></DIV>

顶部


当前时区 GMT+8, 现在时间是 2008-12-2 12:20

赣ICP备06003683号

严禁任何人在本论坛发表与中华人民共和国法律相抵触的言论!

特别声明:本论坛的所有言论只代表发表者个人意见,与本论坛立场无关!

    本论坛支付平台由支付宝提供
携手打造安全诚信的交易社区 Powered by Discuz! 5.5.0  © 2001-2007 Comsenz Inc.
Processed in 0.014016 second(s), 7 queries , Gzip enabled 我要啦免费统计

清除 Cookies - 联系我们 - 流浪者家园 - Archiver - WAP