惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
V
Visual Studio Blog
P
Privacy International News Feed
月光博客
月光博客
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
L
Lohrmann on Cybersecurity
N
News and Events Feed by Topic
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Apple Machine Learning Research
Apple Machine Learning Research
阮一峰的网络日志
阮一峰的网络日志
Webroot Blog
Webroot Blog
T
Threatpost
宝玉的分享
宝玉的分享
The Last Watchdog
The Last Watchdog
小众软件
小众软件
L
LINUX DO - 最新话题
C
Cisco Blogs
T
Troy Hunt's Blog
Schneier on Security
Schneier on Security
酷 壳 – CoolShell
酷 壳 – CoolShell
www.infosecurity-magazine.com
www.infosecurity-magazine.com
雷峰网
雷峰网
G
GRAHAM CLULEY
有赞技术团队
有赞技术团队
Know Your Adversary
Know Your Adversary
博客园 - 叶小钗
罗磊的独立博客
V
V2EX
博客园 - Franky
P
Proofpoint News Feed
SecWiki News
SecWiki News
腾讯CDC
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Jina AI
Jina AI
博客园 - 三生石上(FineUI控件)
S
Secure Thoughts
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Google DeepMind News
Google DeepMind News
Attack and Defense Labs
Attack and Defense Labs
人人都是产品经理
人人都是产品经理
The Cloudflare Blog
PCI Perspectives
PCI Perspectives
V2EX - 技术
V2EX - 技术
Google DeepMind News
Google DeepMind News
Last Week in AI
Last Week in AI
aimingoo的专栏
aimingoo的专栏
Cisco Talos Blog
Cisco Talos Blog
N
News and Events Feed by Topic
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
S
SegmentFault 最新的问题

博客园 - bestcomy

在OPENSUE 11.3 上安装 sysstat Upload bug in MOSS 2007 / Windows Server 2008 - bestcomy Excel列名转换 ASP.NET MVC 源代码发布! 微软项目组招聘.NET开发人员(北京) 欢迎访问我的新BLOG空间 SharePoint 胡言乱语 你觉得vs.net那些地方让你使用起来很不爽? Include javascript and css dynamically - bestcomy Two ways to get HtmlTextWriter for HTML rendering How to set value for webpart’s properties when I create a new sharepoint template Get the true value of a calculate field in SharePoint 调用自定义event时需要注意的一个问题 self==top 如何设置AD用户的"用户下次登陆时须更改密码"属性 (LDAP Provider) 微软 and 香烟 Cool!!! Virtual Earth Technology Preview sth about our coding life 还没有Windows Live Messenger的朋友看过来
Clienside ProgressIndicator - bestcomy - 博客园
bestcomy · 2008-04-03 · via 博客园 - bestcomy

  1var ProgressIndicator = {
  2        isShow  :   false,
  3        height  :   100,
  4        width   :   300,
  5        target  :   self,
  6        spinner    :   "../images/spinner.gif",
  7        show    :   function(width,height,target)
  8        {
  9            if(this.isShow==false)
 10            {
 11                if(arguments.length >= 2)
 12                {
 13                    this.width = width;
 14                    this.height = height;
 15                    if(arguments.length>2)
 16                        this.target = target;
 17                }

 18                var size = this.getMaskSize();
 19                this.target.document.body.insertAdjacentHTML("beforeEnd","<div id=\"maskskin\" style=\"position:absolute;left:0px;top:0px;background-color:#333333;opacity: .4;filter: alpha(opacity=40);z-index:1000;width:"+size.width+"px;height:"+size.height+"px;\"></div>");
 20                var position = this.getCenterPosition();
 21                this.target.document.body.insertAdjacentHTML("beforeEnd","<IFRAME name=\"masklayer\" style=\"border:1px solid buttontext;position:absolute;z-index:1001;left:"+position.left+"px;top:"+position.top+"px;\" frameborder=0 width=\""+this.width+"\" height=\""+this.height+"\" src=\"about:blank\"/>");
 22                var frameDoc = this.target.document.frames["masklayer"].document;
 23                frameDoc.open();
 24                frameDoc.write("<table width=\"100%\" height=\"100%\"><tr><td><img src=\""+this.spinner+"\"></td><td style=\"color:black;font-size:10pt;\"><b>Waiting</b></td></tr><tr><td></td><td style=\"color:black;font-size:10pt;\">Be patient,processing</td></tr></table>");
 25                frameDoc.close();      
 26                this.isShow = true;
 27                this.addEvent(this.target, "resize", ProgressIndicator.centerProgressBar);      
 28                this.addEvent(this.target, "scroll", ProgressIndicator.centerProgressBar);
 29            }

 30            //window.onscroll = this.centerProgressBar;
 31        }
,
 32        hide    :   function()
 33        {
 34            var maskFrame = this.target.document.getElementById("masklayer");
 35            maskFrame.parentNode.removeChild(maskFrame);
 36            var maskSkin = this.target.document.getElementById("maskskin");
 37            maskSkin.parentNode.removeChild(maskSkin);
 38            this.isShow = false;
 39            this.removeEvent(this.target, "resize", ProgressIndicator.centerProgressBar);    
 40            this.removeEvent(this.target, "scroll", ProgressIndicator.centerProgressBar);
 41        }
,
 42        updateMessage  :   function(msg)
 43        {
 44            if(this.isShow)
 45            {
 46                var table = this.target.document.frames["masklayer"].document.getElementsByTagName("TABLE")[0];
 47                table.rows[1].cells[1].innerHTML = msg;
 48            }

 49        }
,
 50        addEvent : function(obj, evType, fn){
 51                     if (obj.addEventListener){
 52                        obj.addEventListener(evType, fn, false);
 53                        return true;
 54                     }
 else if (obj.attachEvent){
 55                        var r = obj.attachEvent("on"+evType, fn);
 56                        return r;
 57                     }
 else {
 58                        return false;
 59                     }

 60                    }
,
 61         removeEvent : function(obj, evType, fn, useCapture){
 62                          if (obj.removeEventListener){
 63                            obj.removeEventListener(evType, fn, useCapture);
 64                            return true;
 65                          }
 else if (obj.detachEvent){
 66                            var r = obj.detachEvent("on"+evType, fn);
 67                            return r;
 68                          }
 else {
 69                            alert("Handler could not be removed");
 70                          }

 71                        }
,
 72         getViewportHeight : function() {
 73                                if (this.target.innerHeight!=this.target.undefined) return this.target.innerHeight;
 74                                if (this.target.document.compatMode=='CSS1Compat'return this.target.document.documentElement.clientHeight;
 75                                if (this.target.document.body) return this.target.document.body.clientHeight; 
 76
 77                                return this.target.undefined; 
 78                            }
,
 79         getViewportWidth : function(){
 80                                var offset = 17;
 81                                var width = null;
 82                                if (this.target.innerWidth!=this.target.undefined) return this.target.innerWidth; 
 83                                if (this.target.document.compatMode=='CSS1Compat'return this.target.document.documentElement.clientWidth; 
 84                                if (this.target.document.body) return this.target.document.body.clientWidth; 
 85                            }
,
 86         getScrollTop : function(){
 87                            if (self.pageYOffset) // all except Explorer
 88                            {
 89                                return self.pageYOffset;
 90                            }

 91                            else if (this.target.document.documentElement && this.target.document.documentElement.scrollTop)
 92                                // Explorer 6 Strict
 93                            {
 94                                return this.target.document.documentElement.scrollTop;
 95                            }

 96                            else if (this.target.document.body) // all other Explorers
 97                            {
 98                                return this.target.document.body.scrollTop;
 99                            }

100                        }
,
101         getScrollLeft : function(){
102                                if (self.pageXOffset) // all except Explorer
103                                {
104                                    return self.pageXOffset;
105                                }

106                                else if (this.target.document.documentElement && this.target.document.documentElement.scrollLeft)
107                                    // Explorer 6 Strict
108                                {
109                                    return this.target.document.documentElement.scrollLeft;
110                                }

111                                else if (this.target.document.body) // all other Explorers
112                                {
113                                    return this.target.document.body.scrollLeft;
114                                }

115                            }
,
116         getMaskSize    :   function()
117                            {            
118                                var theBody = this.target.document.getElementsByTagName("BODY")[0];
119                                        
120                                var fullHeight = this.getViewportHeight();
121                                var fullWidth = this.getViewportWidth();
122                                
123                                // Determine what's bigger, scrollHeight or fullHeight / width
124                                if (fullHeight > theBody.scrollHeight) {
125                                    popHeight = fullHeight;
126                                }
 else {
127                                    popHeight = theBody.scrollHeight;
128                                }

129                                
130                                if (fullWidth > theBody.scrollWidth) {
131                                    popWidth = fullWidth;
132                                }
 else {
133                                    popWidth = theBody.scrollWidth;
134                                }

135                                
136                                return {width:popWidth,height:popHeight+this.height};
137                            }
,
138         getCenterPosition  :   function()
139                                 {
140                                    //var theBody = document.documentElement;
141                                    var theBody = this.target.document.getElementsByTagName("BODY")[0];
142                                    //theBody.style.overflow = "hidden";
143                                    var scTop = parseInt(this.getScrollTop(),10);
144                                    var scLeft = parseInt(theBody.scrollLeft,10);
145                                    
146                                    var fullHeight = this.getViewportHeight();
147                                    var fullWidth = this.getViewportWidth();
148                                    
149                                    var top = scTop + ((fullHeight - this.height) / 2);
150                                    var left = scLeft + ((fullWidth - this.width) / 2);
151                                    
152                                    return {top:top,left:left};
153                                 }
,
154         centerProgressBar  :   function()
155                                 {
156                                    if(ProgressIndicator.isShow)
157                                    {
158                                        var position = ProgressIndicator.getCenterPosition();
159                                        var maskdiv = ProgressIndicator.target.document.getElementsByName("masklayer")[0];
160                                        maskdiv.style.top = position.top + "px";
161                                        maskdiv.style.left = position.left + "px";
162                                    }

163                                 }
             
164    }
;

 1<html>
 2    <head>
 3    <title>ProgressIndicator Demo</title>
 4    <script language="javascript" type="text/javascript" src="ProgressIndicator.js"></script>
 5    <script language="javascript" type="text/javascript">
 6    <!--
 7
 8    ProgressIndicator.spinner = "spinner.gif";
 9
10    //-->
11    
</script>
12    </head>
13<body>
14<h2>ProgressIndicator Demo</h2>
15<hr/>
16<input type="button" value="Show ProgressIndicator" onclick="ProgressIndicator.show()"><br/><br/>
17<input type="button" value="Show ProgressIndicator[400,150]" onclick="ProgressIndicator.show(400,150,top)">
18</body>
19</html>

仅在IE6中测试过

附件下载