Posted by eDWARD at 15:35
function isExist(sURL) { var xmlHttp; if (window.ActiveXObject){ xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); }else{ xmlHttp=new XMLHttpRequest(); } xmlhttp.abort(); xmlhttp.open("GET",sURL,false); xmlhttp.send(); if (xmlhttp.readyState==4) { if (xmlhttp.status==200) return true; //成功 else if (xmlhttp.status==404) return false; // 没有找到 else if (xmlhttp.status==500) return false; // 服务器错误 else return false; } }
Filed In 学习路上 | Study | Tags: javascript, 程序设计 |
Leave your own response
Fields denoted with a "*" are required. Your comment may require moderation, please be patient.
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>
Name *
Mail *
Website
Message *
Use the following link to trackback from your own site: http://www.zhangzhang.net/articles/2007/01/04/url-exists-javascript-method/trackback/
Octopus supports RSS feed for this post RSS 2.0 , and Trackbacks from other blogs.
品位不凡,威严,略显高深,喜爱一切美丽的事物,易怒,固执,有些利己,但关心接近他的人。谦逊,但非常有野心,有才能,刻苦,是不甚令人满意的伴侣,朋友众多,树敌也多,是可以信赖的人。