解决方案 »

  1.   

    读数据,用定时ajax去请求,至于怎么判断是新数据,自己考虑
    弹出可以自己弄个div,显示和隐藏
      

  2.   

    网站页面设个interval,定时通过ajax去取,有新内容时就提示,内容需要有状态,在提示关闭事件中更新状态为已读。
    另外抓数据也可以用socket。数据的显示类似,关闭事件更新状态为已读,下次数据抓取时就不会抓到已经读取的内容。
      

  3.   

    http://download.csdn.net/detail/cowboylym/4824522
      

  4.   

    csdn的消息通知就是通过socket做的。
      

  5.   

    右下角弹出对话框实例演示
    //页面加载javascript
    <script src="blebHint.js" language="javascript"  >
    </script>
    //设置弹出窗口
    function PopBubble(caption,content,see){  
     
        this.content  = content;  //提示内容
        this.caption= caption;  //提示标题
        this.see= see;    //连接文字
        this.width= 150; //设置弹出窗口的宽度
        this.height = 120;        //设置弹出窗口的高度
        this.timeout= 150;         //设置弹出窗口的停留时间
        this.speed    = 15;      //设置弹出窗口的弹出速度
        this.step    = 2;  //设置弹出窗口的弹出步幅
        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;
    }  
    //显示窗口的弹出效果
    PopBubble.prototype.show = function(){    
    //创建一个顶层窗口对象,该对象只有在IE5.5以上的浏览器才能使用
        var oPopup = window.createPopup();    
        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: #DAED9B'>"  
            str += "<TABLE style='BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid' cellSpacing=0 cellPadding=0 width='100%' bgColor=#EEF7CC 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 += "</TR>"  
            str += "<TR>"  
            str += "<TD style='PADDING-RIGHT: 1px;PADDING-BOTTOM: 1px' colSpan=2 height=" + (h-28) + ">"  
            str += "<DIV style='BORDER-RIGHT: #b9c9ef 1px solid; PADDING-RIGHT: 8px; BORDER-TOP: #7AA14E 1px solid; PADDING-LEFT: 8px; FONT-SIZE: 12px; PADDING-BOTTOM: 8px; BORDER-LEFT: #7AA14E 1px solid; WIDTH: 100%; COLOR: #1f336b; PADDING-TOP: 8px; BORDER-BOTTOM: #b9c9ef 1px solid; HEIGHT: 100%'>" + this.content + "<BR><BR>"  
            str += "<DIV style='WORD-BREAK: break-all' align=left><A href='javascript:void(0)' hidefocus=true id='btCommand'><FONT color=#ff0000>" + this.see+"<embed id='soundControl' src='Windows.wav' mastersound hidden='true' loop='false' autostart='true'></embed>" + "</FONT></A></DIV>"  
            str += "</DIV>"  
            str += "</TD>"  
            str += "</TR>"  
            str += "</TABLE>"  
            str += "</DIV>"  
    //将设置好的DIV添加到顶层窗口的BODY中
        oPopup.document.body.innerHTML = str;     
        this.offset  = 0; 
        var obj  = this;  
    //添加顶层窗口鼠标悬停事件
        oPopup.document.body.onmouseover = function(){obj.pause=true;}
        oPopup.document.body.onmouseout = function(){obj.pause=false;}
        var fun = function(){ 
            var x  = obj.left; 
            var y  = 0; 
            var width    = obj.width; 
            var height    = obj.height; 
                if(obj.offset>obj.height){ 
                    height = obj.height; 
                } else { 
                    height = obj.offset; 
                }  
            y  = obj.bottom - obj.offset; 
            if(y<=obj.top){ 
                 obj.timeout--; 
                 if(obj.timeout==0){ 
                    window.clearInterval(obj.timer);  
                    if(obj.autoHide){
                        obj.hide(); 
                    }
                } 
            } //CodeGo.net/
    else { 
                obj.offset = obj.offset + obj.step; 
            } 
            obj.Pop.show(x,y,width,height);    
     
        }  
        this.timer = window.setInterval(fun,this.speed)      
        var btCommand = oPopup.document.getElementById("btCommand");  
        btCommand.onclick = function(){  
            obj.oncommand();  
        }    
    }   
    //实现窗口的退缩效果
    PopBubble.prototype.hide = function(){ 
     //设置弹出窗口的高度  
            var offset  = this.height>this.bottom-this.top?this.height:this.bottom-this.top; 
            var obj  = this;  
            if(this.timer>0){   
                window.clearInterval(obj.timer);  
            }  
     
            var fun = function(){  
    //判断是否退缩弹出来的窗口
                if(obj.pause==false||obj.close){
    //获取窗口的左边到屏幕左边的距离 
                    var x  = obj.left; 
                    var y  = 0; 
    //获取弹出窗口的宽度
                    var width = obj.width; 
    //设置弹出窗口的高度
                    var height = 0; 

                    if(obj.offset>0){ 
    //获取窗口当前的高度
                        height = obj.offset; 
                    } 
    //设置屏幕的高度
                    y  = obj.bottom - height; 
                    if(y>=obj.bottom){ 
                        window.clearInterval(obj.timer);  
                        obj.Pop.hide();  
                    } else { 
    //设置退缩的步幅
                        obj.offset = obj.offset - obj.step;  
                    } 
    //调用窗口对象弹出窗口
                    obj.Pop.show(x,y,width,height);    
                }             
            }  
     
            this.timer = window.setInterval(fun,this.speed)     
    }  
      

  6.   

    html5的可以考虑websocket,否则就ajax轮询,如果Frame版本高的话,可以考虑用微软的SignalR