`
heioo
  • 浏览: 75105 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

BS 浏览器右下角弹出窗口

阅读更多
写如下代码,在要显示弹出框的页面

try{  
    
          $.ajax({
type: 'POST',
url: "........action",
data : null,
dataType:"json",
success : function(result){
// alert(r);
//var User = {"UserID":11, "Name":"Truly", "Email":"zhuleipro@hotmail.com"};
//alert(User.Name);

var s=result.status;
if(s!="" && s!=null){
var MSG1 = new CLASS_MSN_MESSAGE("aa",200,150,"信息提示:","你好,你有"+s+"条新的舆情信息","查看详情"); 
   MSG1.rect(null,null,null,screen.height-30);
   MSG1.speed    = 50;
MSG1.step    = 10;
MSG1.show(); 
}

}
});
       
        
       clearInterval(start);//执行成功,清除监听  
    }catch(err){return true;} 

将以下内容封装成js文件在页面调用

<!-- 
 
/**//* 
**    ================================================================================================== 
**    类名:CLASS_MSN_MESSAGE 
**    功能:提供类似MSN消息框 
**    示例: 
    --------------------------------------------------------------------------------------------------- 
 
            var MSG = new CLASS_MSN_MESSAGE("aa",200,120,"短消息提示:","您有1封消息","今天请我吃饭哈"); 
                MSG.show(); 
 
*    消息构造 
*/ 
function CLASS_MSN_MESSAGE(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:200; 
    this.height = height?height:120; 
    this.timeout= 150; 
    this.speed    = 20;
    this.step    = 1;
    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;

 
/**//* 
*    隐藏消息方法 
*/ 
CLASS_MSN_MESSAGE.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)     
    } 

CLASS_MSN_MESSAGE.prototype.oncommand = function(){ 
    //this.close = true;
   this.hide(); 
   window.open("/dd/kk/essentiaWords!search.action");//此处为弹出窗口中连接url
  
}
/**//* 
*    消息卸载事件,可以重写 
*/ 
CLASS_MSN_MESSAGE.prototype.onunload = function() { 
    return true; 

/**//* 
*    消息命令事件,要实现自己的连接,请重写它 

*/ 

/**//* 
*    消息显示方法 
*/ 
CLASS_MSN_MESSAGE.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: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid; Z-INDEX: 99999; LEFT: 0px; BORDER-LEFT: #a6b4cf 1px solid; WIDTH: " + w + "px; BORDER-BOTTOM: #455690 1px solid; POSITION: absolute; TOP: 0px; HEIGHT: " + h + "px; BACKGROUND-COLOR: #c9d3f3'>" 
        str += "<TABLE style='BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid' cellSpacing=0 cellPadding=0 width='100%' bgColor=#cfdef4 border=0>" 
        str += "<TR>" 
        str += "<TD style='FONT-SIZE: 12px;COLOR: #0f2c8c' width=30 height=24></TD>" 
        str += "<TD style='PADDING-LEFT: 4px; FONT-WEIGHT: normal; FONT-SIZE: 12px; COLOR: #1f336b; 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: #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%'>" + this.title + "<BR><BR>" 
        str += "<DIV style='WORD-BREAK: break-all' align=left><A href='javascript:void(0)' hidefocus=false id='btCommand'><FONT color=#ff0000>" + 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(); 
    }   
  var ommand = oPopup.document.getElementById("ommand"); 
      ommand.onclick = function(){ 
       //this.close = true;
    me.hide(); 
window.open(ommand.href);
    }  

/**//*
** 设置速度方法
**/
CLASS_MSN_MESSAGE.prototype.speed = function(s){
    var t = 20;
    try {
        t = praseInt(s);
    } catch(e){}
    this.speed = t;
}
/**//*
** 设置步长方法
**/
CLASS_MSN_MESSAGE.prototype.step = function(s){
    var t = 1;
    try {
        t = praseInt(s);
    } catch(e){}
    this.step = t;
}
 
CLASS_MSN_MESSAGE.prototype.rect = function(left,right,top,bottom){
    try {
        this.left        = left    !=null?left:this.right-this.width;
        this.right        = right    !=null?right:this.left +this.width;
        this.bottom        = bottom!=null?(bottom>screen.height?screen.height:bottom):screen.height;
        this.top        = top    !=null?top:this.bottom - this.height;
    } catch(e){}
}

//同时两个有闪烁,只能用层代替了,不过层不跨框架
//var MSG2 = new CLASS_MSN_MESSAGE("aa",200,120,"短消息提示:","您有2封消息","好的啊"); 
//   MSG2.rect(100,null,null,screen.height);
//    MSG2.show(); 
//--> 
分享到:
评论

相关推荐

    BS浏览器,开发VRML

    很强大的VRML浏览器;用起来得心应手。

    很不错的js弹出窗口的类

    在Web开发中,尤其在基于浏览器(Browser/Server,BS)的系统中,JavaScript弹出窗口类是不可或缺的工具。这款名为"DHTML弹出窗口"的程序提供了方便的弹出窗口解决方案,适用于那些希望增强用户体验的开发者。 首先...

    BS浏览器X3D浏览器

    BS_Contact_VRML-X3D_70.exe

    X3D完整安装包 附 BS浏览器

    《X3D完整安装包与BS浏览器的详细指南》 X3D,全称为eXtensible 3D,是一种开放标准的Web 3D图形技术,它允许在网页上直接展示三维模型和交互式场景,无需任何插件。X3D支持多种3D建模工具,提供丰富的功能,包括...

    lightbox弹出窗口背景变灰代码

    Lightbox是一种常见的网页设计技术,用于在用户点击图像时显示一个全屏或半透明的弹出窗口,通常用于查看大图或多媒体内容。在这种模式下,网页背景通常会变暗或“变灰”,以增强焦点并减少干扰。下面将详细解释如何...

    基于jquery右下角消息弹出框,改进(类似只能手机通知)

    基于jQuery的右下角消息弹出框是一种常见的提示用户信息的方式,特别是在Web应用程序中。"基于jQuery右下角消息弹出框,改进(类似只能手机通知)"这个项目正是针对这一需求进行的优化,旨在提升Web应用的消息提示...

    BS结构下web浏览器使用IC卡读卡器的方法

    在BS(Browser/Server,浏览器/服务器)架构下,Web浏览器通过与服务器端进行通信来实现用户界面的展示和数据处理。在这种环境下,使用IC卡读卡器进行数据交互是常见的需求。本文档将详细介绍在BS架构下Web浏览器...

    用于VRML文件浏览、显示,BS-Contact、cortona3d-x64浏览器插件

    在IT领域,虚拟现实建模语言(Virtual Reality Modeling ...随着WebGL等技术的发展,虽然现代浏览器已经内置了对3D的支持,但这些插件仍然在特定场景下发挥着重要作用,特别是对于需要复杂交互和高性能渲染的项目。

    如何在关闭跨行浏览器的内联弹出窗口时停止html5视频

    然而,在某些场景下,我们可能希望在用户关闭内联弹出窗口(如模态框)时停止视频播放,以避免资源浪费和用户体验上的不协调。在标题提到的问题中,我们关注的是如何利用HTML5、JavaScript、jQuery以及对浏览器特性...

    InstallAnywhere,BS架构程序打包成CS客户端安装包

    在软件开发过程中,有时候我们需要将基于浏览器的BS(Browser-Server)架构程序转换为客户端可以离线使用的CS(Client-Server)安装包。这时,一款强大的打包工具就显得尤为重要。InstallAnywhere是一款功能丰富的跨...

    pb 实现仿BS界面 dw菜单 powerbuild

    1. **设计界面**:利用PowerBuilder的窗口对象(Window)和数据窗口对象,我们可以创建出与Web页面类似的布局。数据窗口可以模拟网页表格,用于展示数据,同时支持多种布局样式和操作,如分页、排序、过滤等。 2. *...

    winfrom使用chrome浏览器完美打包Bs项目

    "winfrom使用chrome浏览器完美打包Bs项目"这个主题就是探讨如何在WinForm应用中嵌入Chromium内核的浏览器,实现类似Chrome的浏览效果,并将整个Web应用完美地整合到本地应用程序中。 首先,我们需要了解的是Cef...

    BS和CS架构

    BS架构和CS架构是两种常见的软件系统架构,分别代表浏览器/服务器架构和客户机/服务器架构。以下是对BS和CS架构的详细介绍。 BS架构(Browser/Server架构) BS架构是一种基于浏览器和服务器的架构,用户通过WWW...

    PB做的BS界面系统

    标题中的“PB做的BS界面系统”指的是使用PowerBuilder(PB)开发的基于浏览器-服务器(Browser-Server,BS)架构的用户界面系统。PowerBuilder是一款强大的可视化编程工具,尤其擅长于构建数据库应用系统。在BS架构...

    ExplorerTest2017-11-21 22-12-39.rar_12.21_BS_IE_浏览器_监视

    标题“ExplorerTest2017-11-21 22-12-39.rar_12.21_BS_IE_浏览器_监视”暗示了这是一个关于监控Internet Explorer(IE)浏览器数据的项目,可能用于测试或数据分析目的。这个项目可能在2017年11月21日的特定时间点...

    CVR100UD_BS开发包(普通浏览器插件)V4.0

    首先,CVR100UD_BS开发包是针对华视电子的身份证读卡器CVR-100UC设计的,主要用于在浏览器环境下实现身份证信息的读取。这个版本为V4.0,相较于之前的版本,可能包含了性能优化和新功能的添加,以适应不断变化的技术...

    CS与BS模式区别与联系

    BS结构的优点是可以充分利用浏览器技术的成熟和普及,实现原来需要复杂专用软件才能实现的强大功能,并节约了开发成本。BS结构还可以降低客户端的维护和升级的成本和工作量,降低了用户的总体拥有成本(TCO)。 BS...

Global site tag (gtag.js) - Google Analytics