• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录

Angel----部落阁
Xcode10
博客园    首页    新随笔    联系   管理    订阅  订阅
Web进度条的简单方案
using System;
using System.Web;

namespace webDBADMIN.UserControls
{
    /// <summary>
    /// WebProgressBar Web页面使用的进度条。仅提供静态方法。
    /// </summary>
    public class WebProgressBar
    {
        private WebProgressBar()
        {
        }
        public static void Show()
        {
            HttpResponse Response = System.Web.HttpContext.Current.Response ;
            Response.Write("<div id='showtext' style='z-index:9999;position: absolute; left:0; top:300;font-size:12px'></div><div style='z-index:9999;position: absolute; left:0; top:320;' id='mydiv' style=\"BACKGROUND-COLOR:blue;width:0px\">");
            Response.Write("_");
            Response.Write("</div>");
            Response.Write("<script>mydiv.innerText = '';</script>");
            Response.Write("<script language=javascript>;");
            Response.Write("var dots = 0;var dotmax = 15;function ShowWait()");
            Response.Write("{var output; showtext.innerText = '正在装载页面';dots++;if(dots>=dotmax)dots=1;");
            Response.Write("mydiv.style.width = dots*40}");
            Response.Write("function StartShowWait(){mydiv.style.visibility = 'visible'; ");
            Response.Write("window.setInterval('ShowWait()',1000);}");
            Response.Write("function HideWait(){showtext.style.visibility = 'hidden';mydiv.style.visibility = 'hidden';");
            Response.Write("window.clearInterval();}");
            Response.Write("StartShowWait();</script>");
            Response.Flush();
        }
        public static void Hide()
        {
            HttpResponse Response = System.Web.HttpContext.Current.Response ;
            Response.Write("<script>HideWait();</script>");
            Response.Flush();
        }
    }
}
posted on 2007-06-09 22:54  angelfeather  阅读(1079)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3