模拟MSN和QQ的上线提示效果 区别IE和FF浏览器
类似QQ或MSN上的 上线提示:
老大说 项目里要用到 刚刚在网上找的代码 随便改了一下 特别针对IE和FF设计了不同的效果!
<DIV id=upad style="BORDER-RIGHT: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid; Z-INDEX: 99999; LEFT: 64px; VISIBILITY: hidden; BORDER-LEFT: #a6b4cf 1px solid; WIDTH: 200px; BORDER-BOTTOM: #455690 1px solid; POSITION: absolute; TOP: 374px; HEIGHT: 115px; BACKGROUND-COLOR: #c9d3f3">
<TABLE style="BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid" cellSpacing=0 cellPadding=0 width="100%" bgColor=#cfdef4 border=0>
<TBODY>
<TR>
<TD style="FONT-SIZE: 12px; BACKGROUND-IMAGE: none; COLOR: #0f2c8c" width=30 height=24> </TD>
<TD style="PADDING-LEFT: 4px; FONT-WEIGHT: normal; FONT-SIZE: 12px; BACKGROUND-IMAGE: none; COLOR: #1f336b; PADDING-TOP: 4px" width="100%"><STRONG>你的好友上线了!</STRONG></TD>
<TD align=right width=192><SPAN title=关闭 style="FONT-WEIGHT: bold; FONT-SIZE: 12px; CURSOR: hand; COLOR: red; MARGIN-RIGHT: 4px" onclick=closeDiv()>×</SPAN></TD></TR>
<TR>
<TD style="PADDING-RIGHT: 1px; BACKGROUND-IMAGE: none; PADDING-BOTTOM: 1px" colSpan=3 height=90>
<DIV id="kill" style="BORDER-RIGHT: #b9c9ef 1px solid; BORDER-TOP: #728eb8 1px solid; PADDING-LEFT: 13px; FONT-SIZE: 12px; PADDING-BOTTOM: 13px; BORDER-LEFT: #728eb8 1px solid; WIDTH: 90%; COLOR: #1f336b; PADDING-TOP: 18px; BORDER-BOTTOM: #b9c9ef 1px solid; HEIGHT: 63%">
星空下的传说上线了,赶快和他联系吧!</DIV>
<SCRIPT language=JavaScript>
window.onload = getMsg;
window.onresize = resizeDiv;
window.onerror = function(){}
//短信提示使用(asilas添加)
var divTop,divLeft,divWidth,divHeight,docHeight,docWidth,objTimer,i = 0;
function getMsg()
{
if(navigator.userAgent.indexOf("Firefox") > 0) {
var divname = document.getElementById("kill");
divname.style.height="63%";
divname.style.width="89%";
}else{
var divname = document.getElementById("kill");
divname.style.height="90%";
divname.style.width="95%";
}
try{
divTop = parseInt(document.getElementById("upad").style.top,10)
divLeft = parseInt(document.getElementById("upad").style.left,10)
divHeight = parseInt(document.getElementById("upad").offsetHeight,10)
divWidth = parseInt(document.getElementById("upad").offsetWidth,10)
docWidth = document.body.clientWidth;
docHeight = document.body.clientHeight;
document.getElementById("upad").style.top = parseInt(document.body.scrollTop,10) + docHeight + 10;// divHeight
document.getElementById("upad").style.left = parseInt(document.body.scrollLeft,10) + docWidth - divWidth
document.getElementById("upad").style.visibility="visible"
objTimer = window.setInterval("moveDiv()",10)
}
catch(e){}
}
function resizeDiv()
{
try{
divHeight = parseInt(document.getElementById("upad").offsetHeight,10)
divWidth = parseInt(document.getElementById("upad").offsetWidth,10)
docWidth = document.body.clientWidth;
docHeight = document.body.clientHeight;
document.getElementById("upad").style.top = docHeight - divHeight + parseInt(document.body.scrollTop,10)
document.getElementById("upad").style.left = docWidth - divWidth + parseInt(document.body.scrollLeft,10)
}
catch(e){}
}
function moveDiv()
{
try
{
if(parseInt(document.getElementById("upad").style.top,10) <= (docHeight - divHeight + parseInt(document.body.scrollTop,10)))
{
window.clearInterval(objTimer)
objTimer = window.setInterval("resizeDiv()",1)
}
divTop = parseInt(document.getElementById("upad").style.top,10)
document.getElementById("upad").style.top = divTop - 1
}
catch(e){}
}
function closeDiv()
{
document.getElementById('upad').style.visibility='hidden';
if(objTimer) window.clearInterval(objTimer)
}
</SCRIPT>
</TD>
</TR>
</TBODY>
</TABLE>
</DIV>
老大说 项目里要用到 刚刚在网上找的代码 随便改了一下 特别针对IE和FF设计了不同的效果!
<DIV id=upad style="BORDER-RIGHT: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid; Z-INDEX: 99999; LEFT: 64px; VISIBILITY: hidden; BORDER-LEFT: #a6b4cf 1px solid; WIDTH: 200px; BORDER-BOTTOM: #455690 1px solid; POSITION: absolute; TOP: 374px; HEIGHT: 115px; BACKGROUND-COLOR: #c9d3f3">
<TABLE style="BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid" cellSpacing=0 cellPadding=0 width="100%" bgColor=#cfdef4 border=0>
<TBODY>
<TR>
<TD style="FONT-SIZE: 12px; BACKGROUND-IMAGE: none; COLOR: #0f2c8c" width=30 height=24> </TD>
<TD style="PADDING-LEFT: 4px; FONT-WEIGHT: normal; FONT-SIZE: 12px; BACKGROUND-IMAGE: none; COLOR: #1f336b; PADDING-TOP: 4px" width="100%"><STRONG>你的好友上线了!</STRONG></TD>
<TD align=right width=192><SPAN title=关闭 style="FONT-WEIGHT: bold; FONT-SIZE: 12px; CURSOR: hand; COLOR: red; MARGIN-RIGHT: 4px" onclick=closeDiv()>×</SPAN></TD></TR>
<TR>
<TD style="PADDING-RIGHT: 1px; BACKGROUND-IMAGE: none; PADDING-BOTTOM: 1px" colSpan=3 height=90>
<DIV id="kill" style="BORDER-RIGHT: #b9c9ef 1px solid; BORDER-TOP: #728eb8 1px solid; PADDING-LEFT: 13px; FONT-SIZE: 12px; PADDING-BOTTOM: 13px; BORDER-LEFT: #728eb8 1px solid; WIDTH: 90%; COLOR: #1f336b; PADDING-TOP: 18px; BORDER-BOTTOM: #b9c9ef 1px solid; HEIGHT: 63%">
星空下的传说上线了,赶快和他联系吧!</DIV>
<SCRIPT language=JavaScript>
window.onload = getMsg;
window.onresize = resizeDiv;
window.onerror = function(){}
//短信提示使用(asilas添加)
var divTop,divLeft,divWidth,divHeight,docHeight,docWidth,objTimer,i = 0;
function getMsg()
{
if(navigator.userAgent.indexOf("Firefox") > 0) {
var divname = document.getElementById("kill");
divname.style.height="63%";
divname.style.width="89%";
}else{
var divname = document.getElementById("kill");
divname.style.height="90%";
divname.style.width="95%";
}
try{
divTop = parseInt(document.getElementById("upad").style.top,10)
divLeft = parseInt(document.getElementById("upad").style.left,10)
divHeight = parseInt(document.getElementById("upad").offsetHeight,10)
divWidth = parseInt(document.getElementById("upad").offsetWidth,10)
docWidth = document.body.clientWidth;
docHeight = document.body.clientHeight;
document.getElementById("upad").style.top = parseInt(document.body.scrollTop,10) + docHeight + 10;// divHeight
document.getElementById("upad").style.left = parseInt(document.body.scrollLeft,10) + docWidth - divWidth
document.getElementById("upad").style.visibility="visible"
objTimer = window.setInterval("moveDiv()",10)
}
catch(e){}
}
function resizeDiv()
{
try{
divHeight = parseInt(document.getElementById("upad").offsetHeight,10)
divWidth = parseInt(document.getElementById("upad").offsetWidth,10)
docWidth = document.body.clientWidth;
docHeight = document.body.clientHeight;
document.getElementById("upad").style.top = docHeight - divHeight + parseInt(document.body.scrollTop,10)
document.getElementById("upad").style.left = docWidth - divWidth + parseInt(document.body.scrollLeft,10)
}
catch(e){}
}
function moveDiv()
{
try
{
if(parseInt(document.getElementById("upad").style.top,10) <= (docHeight - divHeight + parseInt(document.body.scrollTop,10)))
{
window.clearInterval(objTimer)
objTimer = window.setInterval("resizeDiv()",1)
}
divTop = parseInt(document.getElementById("upad").style.top,10)
document.getElementById("upad").style.top = divTop - 1
}
catch(e){}
}
function closeDiv()
{
document.getElementById('upad').style.visibility='hidden';
if(objTimer) window.clearInterval(objTimer)
}
</SCRIPT>
</TD>
</TR>
</TBODY>
</TABLE>
</DIV>