无刷新自动弹出页面
请问如何在ASP页面中,实现当数据库一有新的消息时,客户端就无须刷新页面,自动弹出消息提示页面。
------解决方案--------------------用ajax,定时向服务器端查询数据是否更新
------解决方案--------------------客户端必须定时请求服务器端;
asp不能创建SOCKET;
------解决方案--------------------ajax 可以实现。。。但前提是客户必须打开你的网站。
------解决方案--------------------asp+ajax技术 很简单啊 网上有资料
------解决方案--------------------
就像这样的效果吧
原文出处:http://blog.csdn.net/guyongqing52/article/details/6849678
代码:
//-------------------------------------------
关于在右下脚弹出窗口javascript代码,并用ASP.NET在后台调用(原创)
/*
  构造函数,来初始化相应的属性
*/
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.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)            
}    
/*  
   实现查看超链接    
  */ 
PopBubble.prototype.oncommand = function(){ 
  window.parent.mainFrame.location.href="notReaderMessage.aspx";  
   this.close = true;
   this.hide(); 
}     
/* 
    显示窗口中的div并弹出窗口方法  
  */ 
PopBubble.prototype.show = function(){   
   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>"