oneIceHeart
小小程序员,漫漫程序路

导航

 
//判断文件是否存在
function IsExistsFile(filepath){
	var xmlhttp=null;
	if (window.XMLHttpRequest){
	  xmlhttp=new XMLHttpRequest();
	}else if (window.ActiveXObject){
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.open("GET",filepath,false);
	xmlhttp.send();
	if(xmlhttp.readyState==4){  
		if(xmlhttp.status==200) return true; //url存在  
		else if(xmlhttp.status==404) return false; //url不存在  
		else return false;//其他状态  
	}
}

 

posted on 2013-10-15 16:56  oneIceHeart  阅读(1604)  评论(0)    收藏  举报