类似开心网的信息提示

  
  
  
  
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">       
  2. <HTML>       
  3.  <HEAD>       
  4.   <TITLE>测试页面</TITLE>       
  5.   <script type="text/javascript">       
  6.     var dynamicMsg = null;        
  7.     function init() {        
  8.         dynamicMsg = new DynamicMessage(window.document.title, "【HI,消息】", "【     】");        
  9.     }        
  10.        
  11.     function begin() {        
  12.         dynamicMsg.initIntervalMsg();        
  13.     }        
  14.        
  15.     function end() {        
  16.         dynamicMsg.clearIntervalMsg();        
  17.     }        
  18.        
  19.     /**       
  20.       * 处理新消息提示的操作       
  21.       */        
  22.       function DynamicMessage(defaultMsg, msg, hiddenMsg) {        
  23.         this.initIntervalMsg = function() {        
  24.             this.intervalMsg = setInterval(function() {        
  25.                     if(!this.bMsg) {        
  26.                         window.document.title = msg + " - " + defaultMsg;        
  27.                         this.bMsg = true;        
  28.                     } else {        
  29.                         window.document.title = hiddenMsg + " - " + defaultMsg;        
  30.                         this.bMsg = false;        
  31.                     }               
  32.                 },         
  33.                 1000        
  34.               );        
  35.           };        
  36.                   
  37.           this.clearIntervalMsg = function() {        
  38.             if(this.intervalMsg != null) {        
  39.                 clearInterval(this.intervalMsg);        
  40.                 window.document.title = defaultMsg;        
  41.                 this.bMsg = false;        
  42.             }        
  43.           };        
  44.       }        
  45.   </script>       
  46.  </HEAD>       
  47.  <BODY onload="init();">       
  48.     <center>       
  49.         <input type="button" value="begin" onclick="begin();"/>       
  50.         <input type="button" value="end" onclick="end();"/>       
  51.         <br/>       
  52.         coloryeah - 为意识增添色彩!        
  53.     </center>       
  54.  </BODY>       
  55. </HTML>

你可能感兴趣的:(职场,休闲,开心网,信息提示)