类似msn消息提示的web桌面提醒(javascript)

  前两天做了类似msn消息提示的web桌面提醒,可以跨框架区域,并且支持多窗口并存,下面给出实现方法:

 1.利用Popup可以跨框架不受限制的特点,构造一个底层的容器

/**//* 
*    底层Popup构造 
*/ 
function Popup(id,width,height){  
    this.id     = id;  
    this.width    = width?width:200; 
    this.height = height?height:120;  
    this.Divs="";  //存放DIV层代码,以便写入Popup容器中
    this.degree=0;  // DIV层数
}

2.在容器内构造重叠的DIV,实现多窗口并存功能

Popup.prototype.BuildDivs= function(degree,message,VISIBILITY,url)
{
       this.degree=degree;
       var str = "<div id=div_"+ degree +" style='VISIBILITY: "+ VISIBILITY +"; POSITION: absolute; TOP: 0px; LEFT: 0px; Z-INDEX:9;'>";

 ……(省略)
   this.Divs+=str;
}

3./**//* 
*    消息显示方法 
*/ 
Popup.prototype.show = function(){ 

    var oPopup = window.createPopup(); //IE5.5+  
    
    oPopup.document.body.innerHTML = this.Divs;

 ……(略去)

}

4.调用方法

var POP = new CLASS_MSN_MESSAGE("P_popup",264.5,164.5);  
      POP .BuildDivs(1,"您有1封消息","visible","http://www.google.com");
      POP .BuildDivs(2,"您有2封消息","visible","http://www.google.com");
      POP .BuildDivs(3,"您有3封消息","visible","http://www.google.com");
      POP.show();

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值