欢迎来到代码驿站!

JavaScript代码

当前位置:首页 > 网页前端 > JavaScript代码

短信提示使用 特效

时间:2021-06-19 08:19:58|栏目:JavaScript代码|点击:

复制代码 代码如下:

<SCRIPT language=JavaScript> 
<!-- 
window.onload = getMsg; 
window.onresize = resizeDiv; 
window.onerror = function(){} 
//短信提示使用 
var divTop,divLeft,divWidth,divHeight,docHeight,docWidth,objTimer,i = 0; 
function getMsg() 

    try{ 
    divTop = parseInt(document.getElementById("eMeng").style.top,10) 
    divLeft = parseInt(document.getElementById("eMeng").style.left,10) 
    divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10) 
    divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10) 
    docWidth = document.body.clientWidth; 
    docHeight = document.body.clientHeight; 
    document.getElementById("eMeng").style.top = parseInt(document.body.scrollTop,10) + docHeight + 10;//  divHeight 
    document.getElementById("eMeng").style.left = parseInt(document.body.scrollLeft,10) + docWidth - divWidth 
    document.getElementById("eMeng").style.visibility="visible" 
    objTimer = window.setInterval("moveDiv()",10) 
    } 
    catch(e){} 


function resizeDiv() 

    i+=1 
    if(i>600) closeDiv()    //客户想不用自动消失由用户来自己关闭所以屏蔽这句 
    try{ 
    divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10) 
    divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10) 
    docWidth = document.body.clientWidth; 
    docHeight = document.body.clientHeight; 
    document.getElementById("eMeng").style.top = docHeight - divHeight + parseInt(document.body.scrollTop,10) 
    document.getElementById("eMeng").style.left = docWidth - divWidth + parseInt(document.body.scrollLeft,10) 
    } 
    catch(e){} 


function moveDiv() 

    try 
    { 
    if(parseInt(document.getElementById("eMeng").style.top,10) <= (docHeight - divHeight + parseInt(document.body.scrollTop,10))) 
    { 
    window.clearInterval(objTimer) 
    objTimer = window.setInterval("resizeDiv()",1) 
    } 
    divTop = parseInt(document.getElementById("eMeng").style.top,10) 
    document.getElementById("eMeng").style.top = divTop - 1 
    } 
    catch(e){} 

function closeDiv() 

    document.getElementById('eMeng').style.visibility='hidden'; 
    if(objTimer) window.clearInterval(objTimer) 

--> 
</SCRIPT>

上一篇:Javascript中的奇葩知识,你知道吗?

栏    目:JavaScript代码

下一篇:js检测客户端不是firefox则提示下载

本文标题:短信提示使用 特效

本文地址:http://www.codeinn.net/misctech/144796.html

推荐教程

广告投放 | 联系我们 | 版权申明

重要申明:本站所有的文章、图片、评论等,均由网友发表或上传并维护或收集自网络,属个人行为,与本站立场无关。

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:914707363 | 邮箱:codeinn#126.com(#换成@)

Copyright © 2020 代码驿站 版权所有