Go homepage(回首页)
Upload pictures (上传图片)
Write articles (发文字帖)

The author:(作者)归海一刀
published in(发表于) 2014/3/20 5:15:15
判断远程图片是否存在_[XML教程]

判断远程图片是否存在_[XML教程]

















收集了几种判断远程图片是否存在的方法




js判断:








判断远程图片是否存在,不存在的话替换成设计家园的logo,代码如下:




onerror="javascript:this.src='/images/logo1.gif'">

asp判断:




<%
url= "/images/logo1.gif"
'on error resume next
Set xmlHttp = Server.CreateObject("Microsoft.XMLHTTP")
xmlHttp.open "get ",url,false
xmlHttp.send
if xmlHttp.Status <> 200 then
response.write "不存在"
else
response.write "存在"
end if
%>




设计家园 收集整理

























If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)





QQ:154298438
QQ:417480759