⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uploadprogress.js

📁 依蓝旅游网站管理系统Elan2008.SP2
💻 JS
字号:
// JavaScript Document
var xmlHttpProgress = null;
var progressbar = null;
var url = "../inc/AppProgress.asp"

function initProgress(){
	progressbar = document.getElementById("progressbar");	
}

function phtml(n, s){
	return "<div style=\"width:"+ n +"%; background: blue; text-indent:10px;\">"+ s +"</div>";
}

function createXMLHttp(){
	if(!xmlHttpProgress){
		if(window.XMLHttpRequest){
			xmlHttpProgress = new XMLHttpRequest();
		}else if(window.ActiveXObject){
			try{
				xmlHttpProgress = new ActiveXObject("Msxml4.XMLHTTP");
			}catch(e){
				try{
					xmlHttpProgress = new ActiveXObject("Msxml3.XMLHTTP");
				}catch(e){
					try{
						xmlHttpProgress = new ActiveXObject("Msxml2.XMLHTTP");
					}catch(e){
						try{
							xmlHttpProgress = new ActiveXObject("Microsoft.XMLHTTP");
						}catch(e){}
					}
				}
			}
		}
		if(!xmlHttpProgress){
			progressbar.innerHTML = "<font color=red>create object error !!</font>"
			return false;
		}
	}else{
		return true;
	}	
}

function getUploadProgress(){   
   createXMLHttp();
   try{
		xmlHttpProgress.open("GET",url,true);
		xmlHttpProgress.onreadystatechange = checkUploadProgress;
		xmlHttpProgress.setRequestHeader("Content-Type","text/xml;charset=GB2312;");
		xmlHttpProgress.send(null);	
	}catch(e){
	}
}

function checkUploadProgress(){
	if(xmlHttpProgress.readyState == 4){
		if(xmlHttpProgress.status == 200){
			var p = parseInt(xmlHttpProgress.responseText);	
			if(p>=100){
				progressbar.innerHTML = phtml(100, "Completed ! Please wait for data processing ......");
			}else{
				progressbar.innerHTML = phtml(p, p +"%");
				getUploadProgress();
			}			
		}		
	}
}

function gop(){getUploadProgress()}
initProgress();

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -