查看: 8053|回复: 0
打印 上一主题 下一主题

实例制作:右下角弹出类似QQ或MSN消息提示

[复制链接]
跳转到指定楼层
1#
发表于 2007-10-6 14:34:11 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
台州网址导航
  1. *    消息卸载事件,可以重写  
  2. */  
  3. CLASS_MSN_MESSAGE.prototype.onunload = function() {  
  4.     return true;  
  5. }  
  6. /**//*  
  7. *    消息命令事件,要实现自己的连接,请重写它  
  8. *  
  9. */  
  10. CLASS_MSN_MESSAGE.prototype.oncommand = function(){  
  11.     //this.close = true;
  12.     this.hide();  
  13. window.open("http://www.tzlink.com");
  14.    
  15. }
  16. /**//*  
  17. *    消息显示方法  
  18. */  
  19. CLASS_MSN_MESSAGE.prototype.show = function(){  

  20.     var oPopup = window.createPopup(); //IE5.5+  
  21.    
  22.     this.Pop = oPopup;  
  23.   
  24.     var w = this.width;  
  25.     var h = this.height;  
  26.   
  27.     var str = ""  
  28.         str += ""  
  29.         str += ""  
  30.         str += ""  
  31.         str += "" + this.caption + ""  
  32.         str += ""  
  33.         str += "×"  
  34.         str += ""  
  35.         str += ""  
  36.         str += ""  
  37.         str += "" + this.title + "

  38. "  
  39.         str += "" + this.message + " - 网页素材下载站"  
  40.         str += ""  
  41.         str += ""  
  42.         str += ""  
  43.         str += ""  
  44.         str += ""  
  45.   
  46.     oPopup.document.body.innerHTML = str;
  47.    
  48.   
  49.     this.offset  = 0;
  50.     var me  = this;  

  51.     oPopup.document.body.onmouseover = function(){me.pause=true;}
  52.     oPopup.document.body.onmouseout = function(){me.pause=false;}

  53.     var fun = function(){  
  54.         var x  = me.left;
  55.         var y  = 0;
  56.         var width    = me.width;
  57.         var height    = me.height;

  58.             if(me.offset>me.height){
  59.                 height = me.height;
  60.             } else {
  61.                 height = me.offset;
  62.             }

  63.         y  = me.bottom - me.offset;
  64.         if(y<=me.top){
  65.             me.timeout--;
  66.             if(me.timeout==0){
  67.                 window.clearInterval(me.timer);  
  68.                 if(me.autoHide){
  69.                     me.hide();
  70.                 }
  71.             }
  72.         } else {
  73.             me.offset = me.offset + me.step;
  74.         }
  75.         me.Pop.show(x,y,width,height);   

  76.     }  
  77.   
  78.     this.timer = window.setInterval(fun,this.speed)      
  79.   
  80.      
  81.   
  82.     var btClose = oPopup.document.getElementById("btSysClose");  
  83.   
  84.     btClose.onclick = function(){  
  85.         me.close = true;
  86.         me.hide();  
  87.     }  
  88.   
  89.     var btCommand = oPopup.document.getElementById("btCommand");  
  90.     btCommand.onclick = function(){  
  91.         me.oncommand();  
  92.     }   
  93.   var ommand = oPopup.document.getElementById("ommand");  
  94.       ommand.onclick = function(){  
  95.        //this.close = true;
  96.     me.hide();  
  97. window.open(ommand.href);
  98.     }   
  99. }  
  100. /**//*
  101. ** 设置速度方法
  102. **/
  103. CLASS_MSN_MESSAGE.prototype.speed = function(s){
  104.     var t = 20;
  105.     try {
  106.         t = praseInt(s);
  107.     } catch(e){}
  108.     this.speed = t;
  109. }
  110. /**//*
  111. ** 设置步长方法
  112. **/
  113. CLASS_MSN_MESSAGE.prototype.step = function(s){
  114.     var t = 1;
  115.     try {
  116.         t = praseInt(s);
  117.     } catch(e){}
  118.     this.step = t;
  119. }
  120.   
  121. CLASS_MSN_MESSAGE.prototype.rect = function(left,right,top,bottom){
  122.     try {
  123.         this.left        = left    !=null?left:this.right-this.width;
  124.         this.right        = right    !=null?right:this.left +this.width;
  125.         this.bottom        = bottom!=null?(bottom>screen.height?screen.height:bottom):screen.height;
  126.         this.top        = top    !=null?top:this.bottom - this.height;
  127.     } catch(e){}
  128. }
  129. var MSG1 = new CLASS_MSN_MESSAGE("aa",200,120,"短消息提示:","您有1封消息","懒人图库");  
  130.     MSG1.rect(null,null,null,screen.height-50);
  131.     MSG1.speed    = 10;
  132.     MSG1.step    = 5;
  133.     //alert(MSG1.top);
  134.     MSG1.show();  

  135. //同时两个有闪烁,只能用层代替了,不过层不跨框架
  136. //var MSG2 = new CLASS_MSN_MESSAGE("aa",200,120,"短消息提示:","您有2封消息","好的啊");  
  137. //   MSG2.rect(100,null,null,screen.height);
  138. //    MSG2.show();  
  139. //-->  
复制代码
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 转播转播 分享分享 分享淘帖
台州维博网络(www.tzweb.com)专门运用PHP+MYSQL/ASP.NET+MSSQL技术开发网站门户平台系统等。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

网站推广
关于我们
  • 台州朗动科技(Tzweb.com)拥有多年开发网站平台系统门户手机客户端等业务的成功经验。主要从事:政企网站,系统平台,微信公众号,各类小程序,手机APP客户端,浙里办微应用,浙政钉微应用、主机域名、虚拟空间、后期维护等服务,满足不同企业公司的需求,是台州地区领先的网络技术服务商!

Hi,扫描关注我

Copyright © 2005-2026 站长论坛 All rights reserved

Powered by 站长论坛 with TZWEB Update Techonolgy Support

快速回复 返回顶部 返回列表