熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> JSP教程 >> 正文

右下角彈出類似QQ或MSN消息提示

2013-11-15 11:48:31  來源: JSP教程 

  <SCRIPT language=JavaScript> 
<! 
 
/**//* 
*    消息構造 
*/ 
function CLASS_MSN_MESSAGE(idwidthheightcaptiontitlemessagetargetaction){ 
    thisid     = id; 
    thistitle  = title; 
    thiscaption= caption; 
    ssage= message; 
    thistarget = target; 
    thisaction = action; 
    thiswidth    = width?width:
    thisheight = height?height:
    thistimeout=
    thisspeed    = ;
    thisstep    = ;
    thisright    = screenwidth
    thisbottom = screenheight;
    thisleft    = thisright thiswidth;
    thistop    = thisbottom thisheight;
    thistimer    = ;
    thispause    = false;
    thisclose    = false;
    thisautoHide    = true;

 
/**//* 
*    隱藏消息方法 
*/ 
CLASS_MSN_MESSAGEprototypehide = function(){ 
    if(thisonunload()){ 

  var offset  = thisheight>thisbottomthistop?thisheight:thisbottomthistop;
        var me  = this; 

  if(thistimer>){  
            windowclearInterval(metimer); 
        } 

  var fun = function(){ 
            if(mepause==false||meclose){
                var x  = meleft;
                var y  = ;
                var width = mewidth;
                var height = ;
                if(meoffset>){
                    height = meoffset;
                }
    
                y  = mebottom height;
    
                if(y>=mebottom){
                    windowclearInterval(metimer); 
                    mePophide(); 
                } else {
                    meoffset = meoffset mestep; 
                }
                mePopshow(xywidthheight);   
            }            
        } 

  thistimer = windowsetInterval(funthisspeed)     
    } 

 
/**//* 
*    消息卸載事件可以重寫 
*/ 
CLASS_MSN_MESSAGEprototypeonunload = function() { 
    return true; 

/**//* 
*    消息命令事件要實現自己的連接請重寫它 

*/ 
CLASS_MSN_MESSAGEprototypeoncommand = function(){ 
    //thisclose = true;
    thishide(); 
 windowopen();
  
}
/**//* 
*    消息顯示方法 
*/ 
CLASS_MSN_MESSAGEprototypeshow = function(){ 

  var oPopup = windowcreatePopup(); //IE
   
    thisPop = oPopup; 
 
    var w = thiswidth; 
    var h = thisheight; 
 
    var str = <DIV style=BORDERRIGHT: # px solid; BORDERTOP: #abcf px solid; ZINDEX: ; LEFT: px; BORDERLEFT: #abcf px solid; WIDTH: + w + px; BORDERBOTTOM: # px solid; POSITION: absolute; TOP: px; HEIGHT: + h + px; BACKGROUNDCOLOR: #cdf> 
        str += <TABLE style=BORDERTOP: #ffffff px solid; BORDERLEFT: #ffffff px solid cellSpacing= cellPadding= width=% bgColor=#cfdef border=> 
        str += <TR> 
        str += <TD style=FONTSIZE: px;COLOR: #fcc width= height=></TD> 
        str += <TD style=PADDINGLEFT: px; FONTWEIGHT: normal; FONTSIZE: px; COLOR: #fb; PADDINGTOP: px vAlign=center width=%> + thiscaption + </TD> 
        str += <TD style=PADDINGRIGHT: px; PADDINGTOP: px vAlign=center align=right width=> 
        str += <SPAN title=關閉 style=FONTWEIGHT: bold; FONTSIZE: px; CURSOR: hand; COLOR: red; MARGINRIGHT: px id=btSysClose >×</SPAN></TD> 
        str += </TR> 
        str += <TR> 
        str += <TD style=PADDINGRIGHT: px;PADDINGBOTTOM: px colSpan= height= + (h) + > 
        str += <DIV style=BORDERRIGHT: #bcef px solid; PADDINGRIGHT: px; BORDERTOP: #eb px solid; PADDINGLEFT: px; FONTSIZE: px; PADDINGBOTTOM: px; BORDERLEFT: #eb px solid; WIDTH: %; COLOR: #fb; PADDINGTOP: px; BORDERBOTTOM: #bcef px solid; HEIGHT: %> + thistitle + <BR><BR> 
        str += <DIV style=WORDBREAK: breakall align=left><A javascript:void() hidefocus=false id=btCommand><FONT color=#ff> + ssage + </FONT></A> <A ommand><FONT color=#ff>網頁素材下載站</FONT></A></DIV> 
        str += </DIV> 
        str += </TD> 
        str += </TR> 
        str += </TABLE> 
        str += </DIV> 
 
    oPopupdocumentbodyinnerHTML = str;
   
 
    thisoffset  = ;
    var me  = this; 

  oPopupdocumentbodyonmouseover = function(){mepause=true;}
    oPopupdocumentbodyonmouseout = function(){mepause=false;}

  var fun = function(){ 
        var x  = meleft;
        var y  = ;
        var width    = mewidth;
        var height    = meheight;

  if(meoffset>meheight){
                height = meheight;
            } else {
                height = meoffset;
            }

  y  = mebottom meoffset;
        if(y<=metop){
            metimeout;
            if(metimeout==){
                windowclearInterval(metimer); 
                if(meautoHide){
                    mehide();
                }
            }
        } else {
            meoffset = meoffset + mestep;
        }
        mePopshow(xywidthheight);   

  } 
 
    thistimer = windowsetInterval(funthisspeed)     
 
    
 
    var btClose = oPopupdocumentgetElementById(btSysClose); 
 
    btCloseonclick = function(){ 
        meclose = true;
        mehide(); 
    } 
 
    var btCommand = oPopupdocumentgetElementById(btCommand); 
    btCommandonclick = function(){ 
        meoncommand(); 
    }   
  var ommand = oPopupdocumentgetElementById(ommand); 
      ommandonclick = function(){ 
       //thisclose = true;
    mehide(); 
 windowopen(ommandhref);
    }  

/**//*
** 設置速度方法
**/
CLASS_MSN_MESSAGEprototypespeed = function(s){
    var t = ;
    try {
        t = praseInt(s);
    } catch(e){}
    thisspeed = t;
}
/**//*
** 設置步長方法
**/
CLASS_MSN_MESSAGEprototypestep = function(s){
    var t = ;
    try {
        t = praseInt(s);
    } catch(e){}
    thisstep = t;
}
 
CLASS_MSN_MESSAGEprototyperect = function(leftrighttopbottom){
    try {
        thisleft        = left    !=null?left:thisrightthiswidth;
        thisright        = right    !=null?right:thisleft +thiswidth;
        thisbottom        = bottom!=null?(bottom>screenheight?screenheight:bottom):screenheight;
        thistop        = top    !=null?top:thisbottom thisheight;
    } catch(e){}
}
var MSG = new CLASS_MSN_MESSAGE(aa短消息提示您有封消息懶人圖庫); 
    MSGrect(nullnullnullscreenheight);
    MSGspeed    = ;
    MSGstep    = ;
    //alert(MSGtop);
    MSGshow(); 

  //同時兩個有閃爍只能用層代替了不過層不跨框架
//var MSG = new CLASS_MSN_MESSAGE(aa短消息提示您有封消息好的啊); 
//   MSGrect(nullnullscreenheight);
//    MSGshow(); 
//
</SCRIPT>


From:http://tw.wingwit.com/Article/program/Java/JSP/201311/19659.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.