用xmlhttp的HEAD方法,如果返回200表示存在

解决方案 »

  1.   

    <script>
    function a()
    {
    s=new ActiveXObject("Microsoft.XMLHTTP")
    s.open("HEAD",m.value,false)
    s.send()
    if(s.status==200) alert(m.value+'存在')
    else alert("不存在")
    }
    </script>
    <body>
    <input id=m><input type=button onclick="a()" value=check>
      

  2.   

    See the file() function. It works on http requests too, even though it's grouped with filesystem functions.
    -----------
    转自Php.net
      

  3.   

    What about ftp requests?
      

  4.   

    file()
    得把东西都传来的啊!
      

  5.   

    exist好像不支持remote方式的文件
      

  6.   

    唉!
    那么能不能用socket连接呢?