像MSN,QQ,迅雷类似效果的提示窗口
2007-07-05 23:44
405 查看
今天客户要求在系统中加一个消息提醒功能,就是如果有新工作需要办理,在屏幕的右下角弹出如MSN或QQ之类的提醒框。我整理了一下,希望对需要的人会有所帮助。
<HTML>
<HEAD>
<TITLE> 右下角提示窗口 </TITLE>
<META NAME="Keywords" CONTENT="提示窗口">
<META NAME="Description" CONTENT="提示窗口">
<script type="text/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("loft_win").style.top,10);
divLeft = parseInt(document.getElementById("loft_win").style.left,10);
divHeight = parseInt(document.getElementById("loft_win").offsetHeight,10);
divWidth = parseInt(document.getElementById("loft_win").offsetWidth,10);
docWidth = document.body.clientWidth;
docHeight = document.body.clientHeight;
document.getElementById("loft_win").style.top = parseInt(document.body.scrollTop,10) + docHeight + 10;// divHeight
document.getElementById("loft_win").style.left = parseInt(document.body.scrollLeft,10) + docWidth - divWidth;
document.getElementById("loft_win").style.visibility="visible";
objTimer = window.setInterval("moveDiv()",10);
}
catch(e){}
}
//初始化位置
function resizeDiv()
{
i+=1;
//if(i>300) closeDiv() //想不用自动消失由用户来自己关闭所以屏蔽这句
try
{
divHeight = parseInt(document.getElementById("loft_win").offsetHeight,10);
divWidth = parseInt(document.getElementById("loft_win").offsetWidth,10);
docWidth = document.body.clientWidth;
docHeight = document.body.clientHeight;
document.getElementById("loft_win").style.top = docHeight - divHeight + parseInt(document.body.scrollTop,10);
document.getElementById("loft_win").style.left = docWidth - divWidth + parseInt(document.body.scrollLeft,10);
}
catch(e){}
}
//最小化
function minsizeDiv()
{
i+=1
//if(i>300) closeDiv() //想不用自动消失由用户来自己关闭所以屏蔽这句
try
{
divHeight = parseInt(document.getElementById("loft_win_min").offsetHeight,10);
divWidth = parseInt(document.getElementById("loft_win_min").offsetWidth,10);
docWidth = document.body.clientWidth;
docHeight = document.body.clientHeight;
document.getElementById("loft_win_min").style.top = docHeight - divHeight + parseInt(document.body.scrollTop,10);
document.getElementById("loft_win_min").style.left = docWidth - divWidth + parseInt(document.body.scrollLeft,10);
}
catch(e){}
}
//移动
function moveDiv()
{
try
{
if(parseInt(document.getElementById("loft_win").style.top,10) <= (docHeight - divHeight + parseInt(document.body.scrollTop,10)))
{
window.clearInterval(objTimer);
objTimer = window.setInterval("resizeDiv()",1);
}
divTop = parseInt(document.getElementById("loft_win").style.top,10);
document.getElementById("loft_win").style.top = divTop -1;
}
catch(e){}
}
function minDiv()
{
closeDiv();
document.getElementById('loft_win_min').style.visibility='visible';
objTimer = window.setInterval("minsizeDiv()",1);
}
function maxDiv()
{
document.getElementById('loft_win_min').style.visibility='hidden';
document.getElementById('loft_win').style.visibility='visible';
objTimer = window.setInterval("resizeDiv()",1);
//resizeDiv()
getMsg();
}
function closeDiv()
{
document.getElementById('loft_win').style.visibility='hidden';
document.getElementById('loft_win_min').style.visibility='hidden';
if(objTimer) window.clearInterval(objTimer);
}
<!--右下脚弹出窗口结束-->
-->
</script>
<style type="text/css">
<!--
#loft_win {border:#0066FF 1px solid;}
#loft_win_min {border:#0066FF 1px solid;}
.loft_win_head {color: #FFFFFF; font-size:13px; background-color:#0066FF; height:25px; padding:0,5,0,5;}
#contentDiv {background-color:#FFFFFF; border:#0066FF 1px solid; border-left-style:none; border-right-style:none;}
a { font-size:12px; color:#000000;}
a:link {font-size:12px; color:#999999; text-decoration:none;}
a:visited { font-size:12px; color:#df3465; text-decoration:none;}
a:hover {font-size:12px; color:#df3465; text-decoration:none; border-left-style:none; border-right-style:none; border-top-style:none;}
a:actived {font-size:12px; color:#000000; text-decoration:none;}
-->
</style>
</HEAD>
<BODY>
<!--提示窗口代码开始-->
<!--初状态-->
<DIV id="loft_win" style="Z-INDEX:99999; LEFT: 0px; VISIBILITY: hidden;WIDTH: 180px; POSITION: absolute; TOP: 0px; HEIGHT: 100px;">
<TABLE cellSpacing=0 cellPadding=0 width="100%" bgcolor="#FFFFFF" border=0>
<TR>
<td width="100%" valign="top" align="center">
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="70" class="loft_win_head">提示窗口</td>
<td width="26" class="loft_win_head"> </td>
<td align="right" class="loft_win_head">
<span style="CURSOR: hand;font-size:12px;font-weight:bold;margin-right:4px;" title=最小化 onclick=minDiv() >- </span><span style="CURSOR: hand;font-size:12px;font-weight:bold;margin-right:4px;" title=关闭 onclick=closeDiv() >×</span>
</td>
</tr>
</table>
</td>
</TR>
<TR>
<TD height="100" align="center" valign="middle" colSpan=3>
<div id="contentDiv">
<table width="100%" height="100%" cellpadding="0" cellspacing="0">
<tr>
<td align="center" height="100%" bgcolor="whitesmoke">
<div>
<a href="http://www.sohu.com" target="_blank">您收到了新工作,<br>请及时办理!</a>
</div>
</td>
</tr>
</table>
</div>
</TD>
</TR>
</TABLE>
</DIV>
<!--最小化状态-->
<DIV id="loft_win_min" style="Z-INDEX:99999; LEFT: 0px; VISIBILITY: hidden;WIDTH: 180px; POSITION: absolute; TOP: 0px;">
<TABLE cellSpacing=0 cellPadding=0 width="100%" bgcolor="#FFFFFF" border=0>
<TR>
<td width="100%" valign="top" align="center">
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="70" class="loft_win_head">提示窗口</td>
<td width="26" class="loft_win_head"> </td>
<td align="right" class="loft_win_head">
<span title=还原 style="CURSOR: hand;font-size:12px;font-weight:bold;margin-right:4px;" onclick=maxDiv() >□</span><span title=关闭 style="CURSOR: hand;font-size:12px;font-weight:bold;margin-right:4px;" onclick=closeDiv() >×</span>
</td>
</tr>
</table>
</td>
</TR>
</TABLE>
</DIV>
<!--提示窗口代码结束-->
</BODY>
</HTML>
实现之后的效果如下图所示:
个人感觉还不错,如果有什么问题,可以给我留言。
<HTML>
<HEAD>
<TITLE> 右下角提示窗口 </TITLE>
<META NAME="Keywords" CONTENT="提示窗口">
<META NAME="Description" CONTENT="提示窗口">
<script type="text/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("loft_win").style.top,10);
divLeft = parseInt(document.getElementById("loft_win").style.left,10);
divHeight = parseInt(document.getElementById("loft_win").offsetHeight,10);
divWidth = parseInt(document.getElementById("loft_win").offsetWidth,10);
docWidth = document.body.clientWidth;
docHeight = document.body.clientHeight;
document.getElementById("loft_win").style.top = parseInt(document.body.scrollTop,10) + docHeight + 10;// divHeight
document.getElementById("loft_win").style.left = parseInt(document.body.scrollLeft,10) + docWidth - divWidth;
document.getElementById("loft_win").style.visibility="visible";
objTimer = window.setInterval("moveDiv()",10);
}
catch(e){}
}
//初始化位置
function resizeDiv()
{
i+=1;
//if(i>300) closeDiv() //想不用自动消失由用户来自己关闭所以屏蔽这句
try
{
divHeight = parseInt(document.getElementById("loft_win").offsetHeight,10);
divWidth = parseInt(document.getElementById("loft_win").offsetWidth,10);
docWidth = document.body.clientWidth;
docHeight = document.body.clientHeight;
document.getElementById("loft_win").style.top = docHeight - divHeight + parseInt(document.body.scrollTop,10);
document.getElementById("loft_win").style.left = docWidth - divWidth + parseInt(document.body.scrollLeft,10);
}
catch(e){}
}
//最小化
function minsizeDiv()
{
i+=1
//if(i>300) closeDiv() //想不用自动消失由用户来自己关闭所以屏蔽这句
try
{
divHeight = parseInt(document.getElementById("loft_win_min").offsetHeight,10);
divWidth = parseInt(document.getElementById("loft_win_min").offsetWidth,10);
docWidth = document.body.clientWidth;
docHeight = document.body.clientHeight;
document.getElementById("loft_win_min").style.top = docHeight - divHeight + parseInt(document.body.scrollTop,10);
document.getElementById("loft_win_min").style.left = docWidth - divWidth + parseInt(document.body.scrollLeft,10);
}
catch(e){}
}
//移动
function moveDiv()
{
try
{
if(parseInt(document.getElementById("loft_win").style.top,10) <= (docHeight - divHeight + parseInt(document.body.scrollTop,10)))
{
window.clearInterval(objTimer);
objTimer = window.setInterval("resizeDiv()",1);
}
divTop = parseInt(document.getElementById("loft_win").style.top,10);
document.getElementById("loft_win").style.top = divTop -1;
}
catch(e){}
}
function minDiv()
{
closeDiv();
document.getElementById('loft_win_min').style.visibility='visible';
objTimer = window.setInterval("minsizeDiv()",1);
}
function maxDiv()
{
document.getElementById('loft_win_min').style.visibility='hidden';
document.getElementById('loft_win').style.visibility='visible';
objTimer = window.setInterval("resizeDiv()",1);
//resizeDiv()
getMsg();
}
function closeDiv()
{
document.getElementById('loft_win').style.visibility='hidden';
document.getElementById('loft_win_min').style.visibility='hidden';
if(objTimer) window.clearInterval(objTimer);
}
<!--右下脚弹出窗口结束-->
-->
</script>
<style type="text/css">
<!--
#loft_win {border:#0066FF 1px solid;}
#loft_win_min {border:#0066FF 1px solid;}
.loft_win_head {color: #FFFFFF; font-size:13px; background-color:#0066FF; height:25px; padding:0,5,0,5;}
#contentDiv {background-color:#FFFFFF; border:#0066FF 1px solid; border-left-style:none; border-right-style:none;}
a { font-size:12px; color:#000000;}
a:link {font-size:12px; color:#999999; text-decoration:none;}
a:visited { font-size:12px; color:#df3465; text-decoration:none;}
a:hover {font-size:12px; color:#df3465; text-decoration:none; border-left-style:none; border-right-style:none; border-top-style:none;}
a:actived {font-size:12px; color:#000000; text-decoration:none;}
-->
</style>
</HEAD>
<BODY>
<!--提示窗口代码开始-->
<!--初状态-->
<DIV id="loft_win" style="Z-INDEX:99999; LEFT: 0px; VISIBILITY: hidden;WIDTH: 180px; POSITION: absolute; TOP: 0px; HEIGHT: 100px;">
<TABLE cellSpacing=0 cellPadding=0 width="100%" bgcolor="#FFFFFF" border=0>
<TR>
<td width="100%" valign="top" align="center">
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="70" class="loft_win_head">提示窗口</td>
<td width="26" class="loft_win_head"> </td>
<td align="right" class="loft_win_head">
<span style="CURSOR: hand;font-size:12px;font-weight:bold;margin-right:4px;" title=最小化 onclick=minDiv() >- </span><span style="CURSOR: hand;font-size:12px;font-weight:bold;margin-right:4px;" title=关闭 onclick=closeDiv() >×</span>
</td>
</tr>
</table>
</td>
</TR>
<TR>
<TD height="100" align="center" valign="middle" colSpan=3>
<div id="contentDiv">
<table width="100%" height="100%" cellpadding="0" cellspacing="0">
<tr>
<td align="center" height="100%" bgcolor="whitesmoke">
<div>
<a href="http://www.sohu.com" target="_blank">您收到了新工作,<br>请及时办理!</a>
</div>
</td>
</tr>
</table>
</div>
</TD>
</TR>
</TABLE>
</DIV>
<!--最小化状态-->
<DIV id="loft_win_min" style="Z-INDEX:99999; LEFT: 0px; VISIBILITY: hidden;WIDTH: 180px; POSITION: absolute; TOP: 0px;">
<TABLE cellSpacing=0 cellPadding=0 width="100%" bgcolor="#FFFFFF" border=0>
<TR>
<td width="100%" valign="top" align="center">
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="70" class="loft_win_head">提示窗口</td>
<td width="26" class="loft_win_head"> </td>
<td align="right" class="loft_win_head">
<span title=还原 style="CURSOR: hand;font-size:12px;font-weight:bold;margin-right:4px;" onclick=maxDiv() >□</span><span title=关闭 style="CURSOR: hand;font-size:12px;font-weight:bold;margin-right:4px;" onclick=closeDiv() >×</span>
</td>
</tr>
</table>
</td>
</TR>
</TABLE>
</DIV>
<!--提示窗口代码结束-->
</BODY>
</HTML>
实现之后的效果如下图所示:
个人感觉还不错,如果有什么问题,可以给我留言。
相关文章推荐
- 教你作类似msn(QQ)等网页中窗口的拖动效果
- 类似MSN右下角提示的窗口效果
- JavaScript实现类似QQ、MSN消息提示的效果(转载)
- 类似MSN、QQ消息提示窗口
- 如何制作类似msn(QQ)等网页中的拖动效果
- phpcms模仿QQ和MSN消息提示的效果
- 仿QQ、MSN消息提示窗口的实现(C#)
- 类似MSN提示的页面效果
- 类似MSN提示的页面效果
- 类似MSN提示的页面效果
- 右下角弹出类似QQ或MSN消息提示
- 右下角弹出提示窗口(类似MSN功能)
- 类似MSN提示的页面效果
- 类似msn,qq的右下角消息提示
- winforms实现类似QQ消息框一样的右下角消息提示窗口
- 类似QQ窗口的抖动效果(转)
- 小知识总结--winform 类似QQ的右下角提示窗口不会被其他程序挡住方法
- 模仿QQ、MSN短消息提示窗口
- 页面右下角弹类似QQ或MSN的消息提示
- 实现MSN,QQ消息提示效果[ASP.Net]