<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>儿童摄影系统</title>
<STYLE type=text/css>
.tdhead2 {
 FONT-SIZE: 9pt;
 FILTER: DropShadow(Color=#eeeeee, OffX=1, OffY=1, Positive=1); COLOR: #000000; LETTER-SPACING: 1px; HEIGHT: 10pt
}
</STYLE>
<script language="JavaScript">
//window.onload = viewMsg;                     //加载页面时,即刻获取短消息
window.onresize = resizeDiv;                //根据窗体高度和宽度,改变短消息提示框的高度和宽度
window.onerror = function(){}               //出现错误时,不做任何处理
var divTop,divLeft,divWidth,divHeight,docHeight,docWidth,objTimer,i = 0;//关于位置的相关变量
function viewMsg()
{
   try
   {
     divTop = parseInt(document.getElementById("divMsg").style.top,10)     //div的x坐标
     divLeft = parseInt(document.getElementById("divMsg").style.left,10)   //div的y坐标
     divHeight = parseInt(document.getElementById("divMsg").offsetHeight,10)//div的高度
     divWidth = parseInt(document.getElementById("divMsg").offsetWidth,10)   //div的宽度
     docWidth = document.body.clientWidth;                                  //窗体宽度
     docHeight = document.body.clientHeight;                                //窗体高度
     document.getElementById("divMsg").style.top = parseInt(document.body.scrollTop,10) + docHeight + 10;//设置div的Y坐标
     document.getElementById("divMsg").style.left = parseInt(document.body.scrollLeft,10) + docWidth - divWidth//设置div的X坐标
     document.getElementById("divMsg").style.visibility="visible"   //设置div显示
     objTimer = window.setInterval("moveDiv()",1)                  //设置定时器
   }
   catch(e){}
}
function resizeDiv()
{
   i+=1
   if (i>500) closeDiv()
   try
   {
     divHeight = parseInt(document.getElementById("divMsg").offsetHeight,10)    //设置div高度
     divWidth = parseInt(document.getElementById("divMsg").offsetWidth,10)      //设置div宽度
     docWidth = document.body.clientWidth;                                      //获取窗体宽度
     docHeight = document.body.clientHeight;                                    //设置窗体高度
     document.getElementById("divMsg").style.top = docHeight - divHeight + parseInt(document.body.scrollTop,10)//设置div的y坐标
     document.getElementById("divMsg").style.left = docWidth - divWidth + parseInt(document.body.scrollLeft,10)//设置div的x坐标
   }
   catch(e){}
}
function moveDiv()
{
   try
   {
     if (parseInt(document.getElementById("divMsg").style.top,10) <= (docHeight - divHeight + parseInt(document.body.scrollTop,10)))
     {
       window.clearInterval(objTimer)
       objTimer = window.setInterval("resizeDiv()",1)  //调整div的位置和大小
     }
     divTop = parseInt(document.getElementById("divMsg").style.top,10)//获取y坐标
     document.getElementById("divMsg").style.top = divTop - 1//调整div的Y坐标
   }
   catch(e){}
}
function closeDiv()
{
   document.getElementById('divMsg').style.visibility='hidden';//将短信息提示层隐藏
   if(objTimer) window.clearInterval(objTimer);                 //清除定时器
}
</script>
</head>
<body bottomMargin="0" bgColor="#eed110" leftMargin="2" topMargin="0" rightMargin="2" onLoad="viewMsg();"><!--右下角面板 代码开始-->
<DIV id=divMsg style="BORDER-RIGHT: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid; Z-INDEX:1; LEFT: 0px; BORDER-LEFT: #a6b4cf 1px solid; WIDTH: 200px; BORDER-BOTTOM: #455690 1px solid; POSITION: absolute; TOP: 0px; VISIBILITY: hidden; HEIGHT: 135px; BACKGROUND-COLOR: #c9d3f3">
   <TABLE style="BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid" cellSpacing=0 cellPadding=0 width="100%" bgColor=#e2fbdb border=0>
     <TBODY>
         <TR>
             <TD style="FONT-SIZE: 12px;COLOR: #0f2c8c" width=30 height=24></TD>
             <TD style="FONT-WEIGHT: normal; FONT-SIZE: 12px;COLOR: #1f336b; PADDING-TOP: 4px;PADDING-left: 4px" vAlign=center width="100%">每日提醒:</TD>
             <TD style="PADDING-TOP: 2px;PADDING-right:2px" vAlign=center align=right width=19><span title=关闭 style="CURSOR: hand;color:red;font-size:12px;font-weight:bold;margin-right:4px;" onclick=closeDiv() >×</span></TD>
         </TR>
         <TR>
             <TD style="PADDING-RIGHT: 1px;PADDING-BOTTOM: 1px" colSpan=3 height=110>
                 <DIV align=center style="BORDER-RIGHT: #b9c9ef 1px solid; PADDING-RIGHT: 8px; BORDER-TOP: #728eb8 1px solid; PADDING-LEFT: 8px; FONT-SIZE: 12px; PADDING-BOTTOM: 8px; BORDER-LEFT: #728eb8 1px solid; WIDTH: 100%; COLOR: #1f336b; PADDING-TOP: 8px; BORDER-BOTTOM: #b9c9ef 1px solid; HEIGHT: 100%">
                 今日有<font color=#FF0000>11111</font>条生日提醒&nbsp;&nbsp;<a href="yewutixing/zc_shengritixing.asp" target="_blank"><font color=#FF0000>点击查看</font></a><br>
                 今日有<font color=#FF0000>11111</font>条拍照提醒&nbsp;&nbsp;<a href="yewutixing/zc_paizhaotixing.asp" target="_blank"><font color=#FF0000>点击查看</font></a><br>
                 今日有<font color=#FF0000>11111</font>条选片提醒&nbsp;&nbsp;<a href="yewutixing/zc_xuanpiantixing.asp" target="_blank"><font color=#FF0000>点击查看</font></a><br>
     今日有<font color=#FF0000><2222</font>条定稿提醒&nbsp;&nbsp;<a href="yewutixing/zc_dinggaotixing.asp" target="_blank"><font color=#FF0000>点击查看</font></a><br>
                 今日有<font color=#FF0000>3333333</font>条取片提醒&nbsp;&nbsp;<a href="yewutixing/zc_qupiantixing.asp" target="_blank"><font color=#FF0000>点击查看</font></a><br>
                    <!--<DIV  style="word-break:break-all"></DIV>-->
                 </DIV>
             </TD>
         </TR>
     </TBODY>
   </TABLE>
</DIV>
<!--右下角面板 代码结束-->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table></body></html>这是个仿qq的消息提醒,但当页面中有滚动条时,总是从页面最下方弹出,如何才能使提示框无论滚动条在何位置都从当前屏幕的右下角弹出

解决方案 »

  1.   

    这个在jquery中有一个自定义动画,animate可以设置初始坐标为右下角的坐标,js也是可以的,比如把此隐藏层的坐标设置为右下角,隐藏,到显示的时候让它慢慢弹出到某个位置,就有动画效果了
      

  2.   


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml"> 
    <head> 
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 
    <title>右下角弹出提示信息框</title> 
    </head> 
    <style type="text/css"> 
    #rbbox{
            position:absolute;
            right:0;
            bottom:0;
            width:300px;
            height:0px;
            overflow:hidden;

    .button{
            display:inline;
            float:right;
            font-size:12px;
            cursor:pointer;

    </style> 
    <body>
    <div id="rbbox">
      <a class="button" onclick="closeBox()">关闭</a>
      <iframe src="http://www.phpzixue.cn/404.htm" frameborder="0" height="200" width="300" scrolling="no"></iframe>
    </div> 
    <script language="javascript" type="text/javascript"> 
    window.onload=function(){
            showBox();
            setTimeout("closeBox()",5000)

    function showBox(o){ 
            if (o==undefined) o=document.getElementById("rbbox"); 
            o.style.height=o.clientHeight+2+"px"; 
            if (o.clientHeight<200) setTimeout(function(){showBox(o)},5); 

    function closeBox(){
             document.getElementById("rbbox").style.display="none";

    </script> 
    </body> 
    </html>