php中可以通过好几个函数来判断字符串的URL地址是否有效
if(@file_get_contents("http://community.csdn.net/ui/homepage/images/questions.gif")) echo 'Y'; else echo 'N';或者
if(@fopen("http://community.csdn.net/ui/homepage/images/questions.gif")) echo 'Y'; else echo 'N';很方便 而JS可以这样(只兼容IE,兼容FF的需要AJAX实现)
function isExist(url) { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP") xmlhttp.open("GET",url,false) xmlhttp.send() if(xmlhttp.status==200) return true; else return false; }也很方便
......[ More Detail ]