- <script type="text/javascript">
- <!--
- var loading = function(){
- var ct = document.getElementById("progressbar"),
- desc = ct.getElementsByTagName("div"),
- idx = 0, time = 500, bar = desc[1], desc = desc[2];
- bar.setValue = function(n){
- this.style.width = n + "%"; };
- void function(){
- bar.setValue(idx += (100 - idx) * .2);
- timer = setTimeout(arguments.callee, time += 100);
- }();
- return {
- remove: function(){
- clearTimeout(timer);
- desc.innerhtml = "加载完成";
- bar.setValue(100);
- setTimeout(function(){
- ct.parentNode.removeChild(ct);
- }, 500);
- }
- };
- }();
- setTimeout(loading.remove, 10000);
- //-->
- </script>
- //该片段来自于http://www.codesnippet.cn/detail/090620133955.html
来源: http://www.codesnippet.cn/detail/090620133955.html