页面加载数据量比较大时,出现“数据加载中”的提示

代码实现如下:  
  protected void Page_Load(object sender, EventArgs e)
    {
         //进度条 
         Response.Write(" <div id='mydiv' style='font-size:9pt'>"); 
         Response.Write("_"); 
         Response.Write(" </div>"); 
         Response.Write(" <script>mydiv.innerText = ''; </script>"); 
         Response.Write(" <script language=javascript>;"); 
         Response.Write("var dots = 0;var dotmax = 10;function ShowWait()"); 
         Response.Write("{var output; output = '数据加载中,请稍候';dots++;if(dots>=dotmax)dots=1;"); 
         Response.Write("for(var x = 0;x < dots;x++){output += '·';}mydiv.innerText =  output;}"); 
         Response.Write("function StartShowWait(){mydiv.style.visibility = 'visible'; "); 
         Response.Write("window.setInterval('ShowWait()',1000);}"); 
         Response.Write("function HideWait(){mydiv.style.display = 'none';"); 
         Response.Write("window.clearInterval();}"); 
         Response.Write("StartShowWait(); </script>"); 
         Response.Flush(); 
         Thread.Sleep(8000);

    }

说明:
1、方法不只一种,我只提供这一种而已,呵呵;
2、注意对Thread添加命名空间的引用;

posted @ 2008-07-31 18:40  Haven  阅读(1790)  评论(0编辑  收藏  举报