你可以预判断一下链接URL是否可用<script language="javascript">
function getURL(url)
{
    var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    xmlhttp.open("GET",url,false);
    xmlhttp.send();
    if (xmlhttp.readyState==4)
      alert((xmlhttp.Status==200)?"存在":"不存在");
}
//user like this:
getURL("http://localhost/1.asp")
</script>

解决方案 »

  1.   

    to meizz,我测试了您的程序,不可用啊 ,走到xmlhttp.open("GET",url,false);
    就停止了,但思路非常好,您再帮忙看看吧,多谢.
      

  2.   

    完善一下:<script language="javascript">
    function getURL(url)
    {
        var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        xmlhttp.open("GET",url,false);
        xmlhttp.send();
        if (xmlhttp.readyState==4)
          alert((xmlhttp.Status==200)?"存在":"不存在");
    }try
    {
    getURL("http://localhost:808/1");
    }
    catch(ex)
    {
     alert('未发现该站点提供web服务');
    }
    </script>