js如何获取服务器时间

来源:互联网 发布:activiti5.14源码下载 编辑:程序博客网 时间:2024/05/09 09:17
    var xhr = new XMLHttpRequest();  
    if( !xhr ){  
       xhr = new ActiveXObject("Microsoft.XMLHTTP");  
    }  
    xhr.open("HEAD",location.href,true);  
    xhr.onreadystatechange=function(){  
        if( xhr.readyState == 4 && xhr.status == 200 ){  
             alert(xhr.getResponseHeader("Date"));  
        }  
    }  
    xhr.send(null);
0 0
原创粉丝点击