方法一:(仅适用于ie)

 function CheckStatus(url)
        {
            XMLHTTP = new ActiveXObject("Microsoft.XMLHTTP")
            XMLHTTP.open("HEAD",url,false)
            XMLHTTP.send()
            return XMLHTTP.status==200
        }
        
        function NetPing()
        {
              return CheckStatus("http://www.163.com/index.html");
        }

方法二:(利用jquery,适用所有浏览器)

function NetPing() {
    $.ajax({
        type: "GET",
        cache: false,
        url: "http://www.163.com/index.html",
        data: "",
        success: function() {
            Done(1);
        },
        error: function() {
            Done(0);
        }
    });

}

 

相关文章:

  • 2022-12-23
  • 2021-05-29
  • 2021-11-17
  • 2021-09-18
  • 2021-07-01
  • 2022-12-23
  • 2022-12-23
  • 2021-12-26
猜你喜欢
  • 2022-12-23
  • 2021-09-26
  • 2022-12-23
  • 2022-12-23
  • 2021-06-24
  • 2022-01-08
  • 2022-12-23
相关资源
相似解决方案