如果單單靠javascript要判斷可能有點麻煩
大概思路:
用一個窗口去load欲判斷文件,如果沒有發生error則存在,如果錯誤則不存在。

解决方案 »

  1.   

    xmlhttpxmlhttp.status == 404 //网页不存在
      

  2.   

    <script type="text/javascript">
    function CheckPage(url)
    {
    var h = new ActiveXObject("Microsoft.XMLHTTP");
    h.open("HEAD",url,false);
    h.send();
    return h.status==200;
    }
    if(CheckPage("http://www.heroworld.net/heroes3site/index.htm"))  //测试的页面
    alert("存在");
    else
    alert("不存在");
    </script>有人问过同样问题
    http://community.csdn.net/Expert/topic/3331/3331784.xml?temp=.4060175