进度条

    技术2022-05-11  6

    ProgressBar.htm页面

    <link type="text/css" rel="stylesheet" href="css/ProgressBar.css" />     <script type="text/javascript" src="js/jquery.js"></script>     <script type="text/javascript" src="js/ProgressBar.js"></script>   

    css:

    .loadingInfo{height:28px;line-height:28px;padding:0 20px 0 38px;color:#000;position:absolute;left:430px;top:350px;z-index:9;border:1px solid #FDAB0A;background:#FDFCDE url(../annexPreview/loadinfo.net2b.gif) 10px center no-repeat}

    js:

    var WaitPannel=new Object();         WaitPannel.show = function(msg) {  debugger;                          $("body").append("<div id='contextWaitPannel'></div>");                 $("#contextWaitPannel").attr({left:document.body.clientWidth / 2 - 20,top:document.body.clientHeight / 2 - 30,position:"absolute"}).text(msg).addClass("loadingInfo").show();                                    };         WaitPannel.hide = function() {                $("#contextWaitPannel").remove();         };

    代码里:

    #region 进度条         private void BeginProgress()         {             //根据ProgressBar.htm显示进度条界面             string templateFileName = Path.Combine(Server.MapPath("."), "ProgressBar.htm");             StreamReader reader = new StreamReader(@templateFileName, System.Text.Encoding.GetEncoding("GB2312"));             string html = reader.ReadToEnd();             reader.Close();             Response.Write(html);             Response.Flush();         }         private void SetProgress()         {             string jsBlock = "<script>WaitPannel.show('" + AttachReaderHelper.GetConfigValue(AttachReaderHelper.ConfigKeys.ProgressInfo) + "'); </script>";             Response.Write(jsBlock);             Response.Flush();         }         private void FinishProgress()         {             string jsBlock = "<script>WaitPannel.hide();</script>";             Response.Write(jsBlock);             Response.Flush();         }         #endregion

     

    调用:

                //BeginProgress();//显示进度条             //SetProgress();             //Thread.Sleep(new TimeSpan(0, 0, 5));             //FinishProgress();             //return;


    最新回复(0)