ASP技巧:判断远程图片是否存在

作者:网络 来源:佚名 更新时间:2008-12-04 18:43:20 点击:

 

以下为引用的内容:

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("存在")
}