以下为引用的内容: 判断远程图片是否存在的asp技巧[ASP代码]
function CheckURL(byval A_strUrl) set XMLHTTP = Server.CreateObject("Microsoft.XMLHTTP") XMLHTTP.open "HEAD",A_strUrl,false XMLHTTP.send() CheckURL=(XMLHTTP.status=200) set XMLHTTP = nothing end function Dim imgurl imgurl="UploadFiles/2007829144940734.gif" if CheckURL(imgurl) then response.write "图片存在" else response.write "图片不存在" end if
判断远程图片是否存在[js代码]
{ var oReq = new ActiveXObject("Microsoft.XMLHTTP") oReq.open("Get","UploadFiles/2007829144941621.gif",false); oReq.send(); //alert(oReq.status) if(oReq.status==404) alert('不存在'); else alert("存在") }
|