现在的位置: 首页 > 综合 > 正文

仿QQ或msn在右下角逐渐弹出的消息框

2013年08月04日 ⁄ 综合 ⁄ 共 2092字 ⁄ 字号 评论关闭

 

仿QQ或msn在右下角逐渐弹出的消息框。
从网址复制而来:http://hi.baidu.com/yuanxiangyi/blog/item/70074e16bc35ed4e21a4e97d.html

<!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>

<body>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />s<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />fdf<br /><br /><br /><br /><br /><br /><br /><br /><br />

<script language=javascript>

var PopWidth = 260; //信息框宽度
var PopHeight = 180; //信息框高度
var PopBorder = 25; //距屏幕边缘的距离
var PopShow = 5000; //信息框的显示时间
var PopTop =0;
var showtime, hidetime;
var oPopup = window.createPopup();

function popmsg(msgstr)
{
    oPopup.document.body.innerHTML = "<table style='border: 1 solid #000000' width='" + PopWidth + "' height='"
                             + PopHeight + "' border='0' cellpadding='0' cellspacing='0' bgcolor='0094e6'>"
                             + "<tr><td valign='top'>" + msgstr + "</td></tr></table>";

    //信息框的样式

    popshow();
    oPopup.document.body.onclick = pophide; //单击信息框时开始隐藏
}

//信息框显示程序
function popshow()
{   
    //当不足以显示信息框全部时,缩小信息框高度
    var tmpHeight = PopTop < PopHeight ? PopTop : PopHeight;
   
    //信息框定位,screen.width:屏幕宽度、screen.height:屏幕高度
    oPopup.show(screen.width - (PopWidth + PopBorder), screen.height - PopTop, PopWidth, tmpHeight);
   

    if (PopTop < (PopHeight + PopBorder))
    {
        PopTop = PopTop + 10; //信息框位置递增
    }
    else
    {
        setTimeout("pophide();", PopShow); //准备隐藏信息框
    }

    showtime = setTimeout("popshow();",100);
}

//信息框隐藏程序
function pophide()
{

    if (showtime)
    {
        clearTimeout(showtime); //清除显示时间句柄
    }

    var tmpHeight = PopTop < PopHeight ? PopTop : PopHeight;

    oPopup.show(screen.width - (PopWidth + PopBorder), screen.height - PopTop, PopWidth, tmpHeight);

    if (PopTop > 0)
    {
        PopTop = PopTop - 10;
        hidetime = setTimeout("pophide();",100);
    }
    else
    {
        clearTimeout(hidetime);
        oPopup.hide();          //完全隐藏信息框
    }
}

popmsg("这里是信息框内容aaaaaaaaaa。");
</script>
</body>
</html>

抱歉!评论已关闭.