MSN消息提示类

None.gif < script language = " JavaScript " >   
None.gif
<!--   
None.gif  
None.gif
/*   
None.gif**    ==================================================================================================  
None.gif**    类名:CLASS_MSN_MESSAGE  
None.gif**    功能:提供类似MSN消息框  
None.gif**    示例:  
None.gif    ---------------------------------------------------------------------------------------------------  
None.gif  
None.gif            var MSG = new CLASS_MSN_MESSAGE("aa",200,120,"短消息提示:","您有1封消息","今天请我吃饭哈");  
None.gif                MSG.show();  
None.gif  
None.gif    ---------------------------------------------------------------------------------------------------  
None.gif**    作者:ttyp  
None.gif**    邮件:ttyp@21cn.com  
None.gif**    日期:2005-2-1  
None.gif**    ==================================================================================================  
None.gif*
*/   
None.gif  
None.gif  
None.gif
/*   
None.gif *    消息构造  
None.gif 
*/   
None.gif
function  CLASS_MSN_MESSAGE(id,width,height,caption,title,message,target,action)  
None.gif{  
None.gif    
this .id      =  id;  
None.gif    
this .title   =  title;  
None.gif    
this .caption =  caption;  
None.gif    
this .message =  message;  
None.gif    
this .target  =  target;  
None.gif    
this .action  =  action;  
None.gif    
this .width   =  width ? width: 200 ;  
None.gif    
this .height  =  height ? height: 120 ;  
None.gif    
this .timeout =   3000 ;  
None.gif    
this .speed   =   20
None.gif    
this .step    =   1
None.gif 
None.gif    
this .left    =   0
None.gif    
this .right   =  screen.availWidth  - 1 ;  
None.gif    
this .top     =   0
None.gif    
this .bottom  =  screen.availHeight; 
None.gif    
this .autoHideTimeOut  =   0 ;
None.gif}  
None.gif  
None.gif
/*   
None.gif *    隐藏消息方法  
None.gif 
*/   
None.gifCLASS_MSN_MESSAGE.prototype.hide 
=   function ()  
None.gif{  
None.gif    
if ( this .onunload())      
None.gif    {  
None.gif        
this .Pop.hide();  
None.gif        
if ( this .timer)  
None.gif        {  
None.gif            window.clearInterval(
this .timer);  
None.gif        }  
None.gif    }  
None.gif}  
None.gif  
None.gif
/*   
None.gif *    消息卸载事件,可以重写  
None.gif 
*/   
None.gifCLASS_MSN_MESSAGE.prototype.onunload 
=   function ()  
None.gif{  
None.gif    
return   true ;  
None.gif}  
None.gif
/*   
None.gif *    消息命令事件,要实现自己的连接,请重写它  
None.gif *  
None.gif 
*/   
None.gifCLASS_MSN_MESSAGE.prototype.oncommand 
=   function ()  
None.gif{  
None.gif    alert(
this .message);  
None.gif    
this .hide();  
None.gif}  
None.gif  
None.gif
/*   
None.gif *    消息显示方法  
None.gif 
*/   
None.gifCLASS_MSN_MESSAGE.prototype.show 
=   function ()  
None.gif{  
None.gif    
var  oPopup  =  window.createPopup();  // IE5.5+  
None.gif
  
None.gif    
this .Pop  =  oPopup;  
None.gif  
None.gif    
var  w  =   this .width;  
None.gif    
var  h  =   this .height;  
None.gif  
None.gif    
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'> "   
None.gif        str 
+=   " <TABLE style='BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid' cellSpacing=0 cellPadding=0 width='100%' bgColor=#cfdef4 border=0> "   
None.gif        str 
+=   " <TR> "   
None.gif        str 
+=   " <TD style='FONT-SIZE: 12px;COLOR: #0f2c8c' width=30 height=24></TD> "   
None.gif        str 
+=   " <TD style='PADDING-LEFT: 4px; FONT-WEIGHT: normal; FONT-SIZE: 12px; COLOR: #1f336b; PADDING-TOP: 4px' vAlign=center width='100%'> "   +   this .caption  +   " </TD> "   
None.gif        str 
+=   " <TD style='PADDING-RIGHT: 2px; PADDING-TOP: 2px' vAlign=center align=right width=19> "   
None.gif        str 
+=   " <SPAN title=关闭 style='FONT-WEIGHT: bold; FONT-SIZE: 12px; CURSOR: hand; COLOR: red; MARGIN-RIGHT: 4px' id='btSysClose' >×</SPAN></TD> "   
None.gif        str 
+=   " </TR> "   
None.gif        str 
+=   " <TR> "   
None.gif        str 
+=   " <TD style='PADDING-RIGHT: 1px;PADDING-BOTTOM: 1px' colSpan=3 height= "   +  (h - 28 +   " > "   
None.gif        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> "   
None.gif        str 
+=   " <DIV style='WORD-BREAK: break-all' align=left><A href='javascript:void(0)' hidefocus=true id='btCommand'><FONT color=#ff0000> "   +   this .message  +   " </FONT></A></DIV> "   
None.gif        str 
+=   " </DIV> "   
None.gif        str 
+=   " </TD> "   
None.gif        str 
+=   " </TR> "   
None.gif        str 
+=   " </TABLE> "   
None.gif        str 
+=   " </DIV> "   
None.gif  
None.gif    oPopup.document.body.innerHTML 
=  str;  
None.gif  
None.gif    
var  docWidth     =   this .right;  
None.gif    
var  docHeight    =   this .bottom - h;  
None.gif    
var  offset       =  screen.height  -  screen.availHeight;  
None.gif 
None.gif    
var  me           =   this ;  
None.gif    
var  timer;  
None.gif 
None.gif    
var  fun  =   function ()  
None.gif    {  
None.gif        oPopup.show(docWidth
- w, docHeight  +  offset, w, h);    
None.gif        
if (offset  <=   0 )  
None.gif        {  
None.gif            window.clearInterval(timer);  
None.gif            
if (me.autoHideTimeOut > 0 )
None.gif            {
None.gif                window.setTimeout(
function (){me.hide()},me.autoHideTimeOut);
None.gif            }
None.gif        }  
None.gif        offset 
=  offset  -  me.step;  
None.gif  
None.gif    }  
None.gif
None.gif    
if ( typeof ( this .speed) != " number " || this .speed <= 0 )
None.gif    {
None.gif        
this .speed  =   20 ;
None.gif    }
None.gif
None.gif    timer 
=  window.setInterval(fun, this .speed)      
None.gif  
None.gif     
None.gif  
None.gif    
var  btClose  =  oPopup.document.getElementById( " btSysClose " );  
None.gif  
None.gif    btClose.onclick 
=   function ()  
None.gif    {  
None.gif        me.hide();  
None.gif    }  
None.gif  
None.gif    
var  btCommand  =  oPopup.document.getElementById( " btCommand " );  
None.gif    btCommand.onclick 
=   function ()  
None.gif    {  
None.gif        me.oncommand();  
None.gif    }  
None.gif  
None.gif    
this .timer  =  timer;  
None.gif  
None.gif}  
None.gif  
None.gifCLASS_MSN_MESSAGE.prototype.rect 
=   function (left,right,top,bottom) 
None.gif
None.gif    
try  
None.gif    { 
None.gif        
this .left    =  left     ? left    : 0
None.gif        
this .right   =  right     ? right    :screen.availWidth  - 1
None.gif        
this .top     =  top     ? top    : 0
None.gif        
this .bottom  =  bottom ? bottom    :screen.availHeight; 
None.gif    } 
None.gif    
catch (e) 
None.gif    {} 
None.gif
None.gif 
None.gif
var  msg1  =   new  CLASS_MSN_MESSAGE( " aa " , 200 , 120 , " 短消息提示: " , " 您有1封消息 " , " 今天请我吃饭哈 " );  
None.gif    msg1.speed 
=  2 0 ;
None.gif    msg1.autoHideTimeOut 
=   2000 ;
None.gif    msg1.show();  
None.gif 
None.gif
// 同时两个有闪烁,只能用层代替了,不过层不跨框架 
None.gif//
var MSG2 = new CLASS_MSN_MESSAGE("aa",200,120,"短消息提示:","您有2封消息","好的啊");  
None.gif//
      MSG2.rect(0,null,0,screen.availHeight-120); 
None.gif//
    MSG2.show();  
None.gif
 
None.gif
// -->  
None.gif
</ script >
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值