JavaScript MSN 弹出消息框

**     类名:CLASS_MSN_MESSAGE  
**     功能:提供类似MSN消息框  
**     示例:  
  

**     作者:ttyp  
**     邮件:ttyp@21cn.com  
**     日期:2005-3-18  
**    
**/  

JS 代码:

// JScript 文件
/*
    caption     标题栏
    title       消息标题
    message     消息主题
    target      链接框架
    action      链接地址
*/
function MessShow(id,width,height,caption,title,message,target,action)
{
    this.id         = id;
    this.title      = title;
    this.caption    = caption;
    this.message    = message;
    this.target     = target;
    this.action     = action;
    this.width      = width?width:250;
    this.height     = height?height:150;
    this.timeout    = 250;      //消息停留时间
    this.speed      = 10;       //消息速度,越小越快
    this.step       = 2;        //移动步长
    this.right      = screen.width -1;
    this.bottom     = screen.height;
    this.left       = this.right - this.width;
    this.top        = this.bottom - this.height;
    this.timer      = 0;
    this.pause      = false;
    this.close      = false;
    this.autoHide   = true;
}
// 隐藏消息方法
MessShow.prototype.hide = function()
{
    if(this.onunload())
    {
        var offset = this.height>this.bottom-this.top?this.height:this.bottom-this.top;
        var me = this;
        if(this.timer>0)
        {
            window.clearInterval(me.timer);
        }
        var fun = function()
        {
            if(me.pause==false||me.close)
            {
                var x = me.left;
                var y = 0;
                var width = me.width;
                var height = 0;
                if(me.offset>0){
                    height = me.offset;
                }   
                y = me.bottom - height;   
                if(y>=me.bottom){
                    window.clearInterval(me.timer);
                    me.Pop.hide();
                } else {
                    me.offset = me.offset - me.step;
                }
                me.Pop.show(x,y,width,height);  
            }           
        }
        this.timer = window.setInterval(fun,this.speed)    
    }
}
//消息卸载事件,可以重写

MessShow.prototype.onunload = function()
{
    return true;
}
// 消息命令事件,要实现自己的连接,请重写它
MessShow.prototype.oncommand = function()
{
    window.open(this.action,this.target);
    this.hide();
}
// 消息显示方法
MessShow.prototype.show = function()
{
    var oPopup = window.createPopup(); //IE5.5+    
    this.Pop = oPopup;  
    var w = this.width;
    var h = this.height;
    var str = "<DIV style='BORDER-RIGHT:#005FEE 1px solid; BORDER-TOP:#005FEE 1px solid; Z-INDEX: 99999; LEFT: 0px; BORDER-LEFT:#005FEE 1px solid; WIDTH: " + w + "px; BORDER-BOTTOM:#005FEE 1px solid; POSITION: absolute; TOP: 0px; HEIGHT: " + h + "px; BACKGROUND-COLOR:#FFFFFF'>"
        str += "<TABLE style='BORDER-TOP: #FFFFFF 1px solid; BORDER-LEFT: #FFFFFF 1px solid' cellSpacing=0 cellPadding=0 width='100%' bgColor=#FFFFFF border=0>"
        str += "<TR>"
        str += "<TD style='FONT-SIZE: 12px;COLOR: #0052CC' width=30 height=24>∵</TD>"
        str += "<TD style='PADDING-LEFT: 4px; FONT-WEIGHT: normal; FONT-SIZE: 12px; COLOR:#0052CC; PADDING-TOP: 4px' vAlign=center width='100%'>" + this.caption + "</TD>"
        str += "<TD style='PADDING-RIGHT: 2px; PADDING-TOP: 2px' vAlign=center align=right width=19>"
        str += "<SPAN title=关闭 style='FONT-WEIGHT: bold; FONT-SIZE: 12px; CURSOR: hand; COLOR: red; MARGIN-RIGHT: 4px' id='btSysClose' >×</SPAN></TD>"
        str += "</TR>"
        str += "<TR>"
        str += "<TD style='PADDING-RIGHT: 1px;PADDING-BOTTOM: 1px' colSpan=3 height=" + (h-28) + ">"
        str += "<DIV style='BORDER-RIGHT: FFFFFF 1px solid; PADDING-RIGHT: 8px; BORDER-TOP:#66A3FF 1px solid; PADDING-LEFT: 8px; FONT-SIZE: 12px; PADDING-BOTTOM: 8px; BORDER-LEFT:#FFFFFF 1px solid; WIDTH: 100%; COLOR:#FFFFFF; PADDING-TOP: 8px; BORDER-BOTTOM:#FFFFFF 1px solid; HEIGHT: 100%'><FONT color=#EE0000>" + this.title + "</FONT><BR><BR>"
        str += "<DIV style='WORD-BREAK: break-all' align=left><A href='javascript:void(0)' hidefocus=true id='btCommand'><FONT color=#EE0000>" + this.message + "</FONT></A></DIV>"
        str += "</DIV>"
        str += "</TD>"
        str += "</TR>"
        str += "</TABLE>"
        str += "</DIV>"

    oPopup.document.body.innerHTML = str;
    this.offset = 0;
    var me = this;
    oPopup.document.body.onmouseover = function(){me.pause=true;}
    oPopup.document.body.onmouseout = function(){me.pause=false;}
    var fun = function()
    {
        var x = me.left;
        var y = 0;
        var width    = me.width;
        var height    = me.height;

            if(me.offset>me.height)
            {
                height = me.height;
            } else
            {
                height = me.offset;
            }
        y = me.bottom - me.offset;
        if(y<=me.top)
        {
            me.timeout--;
            if(me.timeout==0)
            {
                window.clearInterval(me.timer);
                if(me.autoHide)
                {
                    me.hide();
                }
            }
        }
        else
        {
            me.offset = me.offset + me.step;
        }
        me.Pop.show(x,y,width,height);
    }  
    this.timer = window.setInterval(fun,this.speed)
    var btClose = oPopup.document.getElementById("btSysClose");
    btClose.onclick = function()
    {
        me.close = true;
        me.hide();
    }
    var btCommand = oPopup.document.getElementById("btCommand");
    btCommand.onclick = function()
    {
        me.oncommand();
    }
}
// 设置速度方法
MessShow.prototype.speed = function(s)
{
    var t = 10;
    try
    {
        t = praseInt(s);
    }
    catch(e){}

    this.speed = t;
}
// 设置步长方法
MessShow.prototype.step = function(s)
{
    var t = 2;
    try
    {
        t = praseInt(s);
    }
    catch(e){}
    this.step = t;
}
MessShow.prototype.rect = function(left,right,top,bottom)
{
    try
    {
        this.left    = left?left:0;
        this.right    = right?right:screen.availWidth -1;
        this.top    = top?top:0;
        this.bottom = bottom?bottom:screen.availHeight;
    }
    catch(e)
    {}
}

后台代码:

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>MSN 弹出消息框</title>
    <script language=javascript type="text/javascript" src="MsnPup.js"></script>
    <script language=javascript type="text/javascript">
      function load()
      {        
         var msg = new MessShow("love",250,150,"信息","天山寒雪,你好!","QQ:757015000 请求加为好友!","_bank",'http://www.baidu.com');
         msg.show();
      }
    </script>
</head>
<body οnlοad="load()">
    <form id="form1" runat="server">
    <div>
    
    </div>
    </form>
</body>

转载于:https://www.cnblogs.com/qinhaijun/archive/2011/08/26/2154446.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/495348.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

一文读懂:深扒人脸识别60年技术发展史

来源&#xff1a;与非网摘要&#xff1a; “他来听我的演唱会&#xff0c;门票换了手铐一对”。最近歌神张学友变阿SIR&#xff0c;演唱会上频频抓到罪犯&#xff0c;将人脸识别技术又一次推到了大众的视线中。“他来听我的演唱会&#xff0c;门票换了手铐一对”。最近歌神张学…

安卓逆向_22( 一 ) --- Xposed【 Android Studio + Xposed 实现简单的 hook 】

From&#xff1a;使用渗透测试框架 Xposed 框架 hook 调试 Android APP&#xff1a;https://www.freebuf.com/articles/terminal/56453.html Xposed框架分析&#xff1a;https://blog.csdn.net/zjx839524906/article/details/81046844 xposted框架 原理 Xposed框架之函数Hoo…

【数据采集】将16进制字符串转化为Double类型输出(依照IEEE754标准)

因为需要读取二进制文件中包含的数据&#xff0c;故需要这样一个转化过程。 鄙人功力太浅&#xff0c;主要参照http://www.cnblogs.com/xinjun/archive/2010/07/28/1787297.html&#xff0c;略有改动&#xff0c;以保证编译运行通过。 1 #include <iostream> 2 #include…

TED演讲 | 2100年,神经学家如何研究人类大脑?

“本文来源于药明康德微信公众号&#xff08;ID&#xff1a;WuXiAppTecChina&#xff09;”除非我们弄清楚如何在健康人体中获得神经元的电活动&#xff0c;否则不会在理解人类大脑或疾病方面取得任何进展。 Were not going to make any progress towards understanding the hu…

安卓逆向_24( 一 ) --- Hook 框架 frida( Hook Java层 和 so层) )

From&#xff1a;Hook 神器家族的 Frida 工具使用详解&#xff1a;https://blog.csdn.net/FlyPigYe/article/details/90258758 详解 Hook 框架 frida ( 信抢红包 )&#xff1a;https://www.freebuf.com/company-information/180480.html APP逆向神器之Frida【Android初级篇】…

VC 创建NT服务程序

VC 创建NT服务程序 #include "Windows.h" #include "Winsvc.h" #include "time.h" #include "stdio.h" SERVICE_STATUS m_ServiceStatus; SERVICE_STATUS_HANDLE m_ServiceStatusHandle; BOOL bRunningtrue; void WINAPI Servi…

安卓逆向_22( 二 ) --- Xposed 学习记录

转载&#xff1a;看雪论坛 堂前燕&#xff1a;https://bbs.pediy.com/thread-252153.htm Xposed 模块编写的那些事&#xff1a;https://www.freebuf.com/articles/terminal/114910.html 看了很多 xposed的教程&#xff0c;自以为掌握了个大概&#xff0c;直到今天整理&#xf…

最前线丨新零售结果、AT暗战,今年的618都讲了哪些故事

来源&#xff1a;36Kr今年的618成了巨头们验收新零售成果的好时机。618源于2010年&#xff0c;最初为京东店庆。2013年天猫加入618大促&#xff0c;苏宁、国美紧随其后。此后&#xff0c;618成为电商价格战的战场&#xff0c;也成为全网狂欢的节日。618今年已经走到底第9个年头…

什么是RUP

一、RUP产生的背景 UML能够用来为系统进行面向对象建模&#xff0c;但是并没有指定应用UML的过程&#xff0c;它仅仅是一种语言&#xff0c;它是独立于任何过程的。如果想要成功的应用UML一个好的过程是必要的。合理的过程能够有效的测度工作进度&#xff0c;控制和改善工作效率…

安卓逆向_24 ( 二 ) --- frida 学习记录

转载&#xff1a;看雪论坛 堂前燕 &#xff1a;https://bbs.pediy.com/thread-252319.htm apk 和 Python脚本 链接&#xff1a;https://pan.baidu.com/s/1KX1fY16NgaYB1FnCrpu0lQ 提取码&#xff1a;t38k 上次记录了下xposed hook java层的学习&#xff0c;这次记录下frid…

动态 | DeepMind 首次披露旗下专利申请情况

来源&#xff1a;AI科技评论摘要&#xff1a;作为一家顶尖的人工智能研究公司&#xff0c;DeepMind 近年来申请了一堆国际专利&#xff0c;但是具体到专利内容和申请数量就不得而知了。近日&#xff0c;DeepMind首次披露了一系列国际专利&#xff0c;这些专利涉及了现代机器学习…

JavaScript获取URL参数

文件1&#xff1a;realwall.js (function(window){var urltool {getUrlParameterByKey : function(url,key){var result "",start,parameterStr,len,paras,i;parameterStr url.split("?");if(parameterStr.length > 1){parameterStr parameterStr[…

Frida Android hook

From&#xff1a;https://eternalsakura13.com/2020/07/04/frida/ 开发环境配置 ( IDE 智能提示 frida )&#xff1a; 下载 nodejs&#xff1a; https://nodejs.org/zh-cn/download/npm install types/frida-gum 见过的较好的frida笔记&#xff1a; https://kevinspider.gith…

寒武纪宣布完成B轮融资 整体估值达25亿美元

来源&#xff1a;网易智能摘要&#xff1a;6月20日&#xff0c;芯片领域公司寒武纪宣布完成数亿美元的B轮融资&#xff0c;由中国国有资本风险投资基金、国新启迪、国投创业、国新资本联合领投。中金资本、中信证券投资&金石投资、TCL资本、中科院科技成果转化基金跟投。原…

安卓模拟器 Genymotion 安装

Form&#xff1a;https://www.runoob.com/w3cnote/android-tutorial-genymotion-install.html Linux (Ubuntu) 下的 Android 模拟器&#xff1a;Genymotion&#xff1a;https://blog.csdn.net/qq_25978793/article/details/49923579 Android 模拟器 Genymotion 安装使用教程详解…

辩论届人机大战:IBM新AI完胜人类冠军!

来源&#xff1a;智东西导语&#xff1a;6月18日&#xff0c;IBM的AI系统Project Debater首次与人类进行现场公开辩论。Project Debater能够理解对方观点&#xff0c;并有针对性地做出清晰的反驳&#xff0c;最终成功战胜人类辩手。6月19日消息&#xff0c;美国时间6月18日&…

没有人能阻止程序员将电脑上的一切搬到网页上

操作系统模拟&#xff08;OS Simulator&#xff09; Web QQ Q版的界面&#xff0c;看起来大体上是模拟Mac OS而不是Windows&#xff0c;不过那些桌面Widget又是Windows的展品。也算是取各家所长。使用他的唯一理由可能就是在没有QQ的电脑上用QQ吧 Windows 3.1 Windows 95(感谢大…

一篇文章带你领悟 Frida 的精髓(基于安卓8.1)

转载&#xff08;一篇文章带你领悟Frida的精髓&#xff08;基于安卓8.1&#xff09;&#xff09;&#xff1a;https://www.freebuf.com/articles/system/190565.html 《Frida操作手册》&#xff1a;https://github.com/hookmaster/frida-all-in-one Frida github 地址&#x…

神经元之间是如何形成“社交网络”的

来源&#xff1a;中科院神经科学研究院摘要&#xff1a;我们的大脑中存在着亿万个神经元&#xff0c;在神经科学领域有一个非常重要的问题&#xff0c;就是一个神经元是如何在这亿万个神经元中选择与某一些神经元形成突触联系的。演讲者&#xff1a;中国科学院神经科学研究所徐…

WinForm 图片变灰方法

最近公司项目用到文件树&#xff0c;对于工程文件中不存在的文件&#xff0c;要给予灰色显示&#xff0c;如何让图片成灰色&#xff0c;在网上找了个效率较高的方法&#xff0c;很方便调用&#xff0c;故记录。 1 public Bitmap ExColorDepth(Image image) 2 { 3 …