求教在手机上用auto.js如何利用服务器时间(网址)进行定时点击 我是js小白一枚,只会最简单的程序,就自学了一周多,想搞一个定时点击程序,但找模板发现只有调用new Date执行,但系统时间误差太大了几乎没有准点成功过,网上找了很多获取服务器的时间在手机上一些符号和字符串没有定义,怎么破,求大佬教 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <p id="time"></p><script>ajax() function ajax(option){ var xhr = null; if(window.XMLHttpRequest){ xhr = new window.XMLHttpRequest(); }else{ // ie xhr = new ActiveObject("Microsoft") } // 通过get的方式请求当前文件 xhr.open("get","/"); xhr.send(null); // 监听请求状态变化 xhr.onreadystatechange = function(){ var time = null, curDate = null; if(xhr.readyState===2){ // 获取响应头里的时间戳 time = xhr.getResponseHeader("Date"); console.log(xhr.getAllResponseHeaders()) curDate = new Date(time); document.getElementById("time").innerHTML = "服务器时间是:"+curDate.getFullYear()+"-"+(curDate.getMonth()+1)+"-"+curDate.getDate()+" "+curDate.getHours()+":"+curDate.getMinutes()+":"+curDate.getSeconds(); } } }</script>获取服务器时间 js判断合法url链接? 急!!求各位解答,谢谢…… 求网页简体中文繁体中文切换的js 修改js版的日期控件 如何控制多函数调用递归函数时不抢进程? 简单的下拉框取值问题 小菜鸟请求帮助修改代码 Table里怎么自动显示行号? 请大家帮菜鸟的一个忙,急死人啦!为什么把javascritp代码插到网页中老是不对。 如何用javascript控制改变一个文本框的背景颜色? 关于JS里面换行问题 Bootstrap fileinput插件预览乱码问题 如何用jQuery在页面实现把一个table中的tb拖拽到另外一个table中,并且把数据添加到新的table中
<script>
ajax()
function ajax(option){
var xhr = null;
if(window.XMLHttpRequest){
xhr = new window.XMLHttpRequest();
}else{ // ie
xhr = new ActiveObject("Microsoft")
}
// 通过get的方式请求当前文件
xhr.open("get","/");
xhr.send(null);
// 监听请求状态变化
xhr.onreadystatechange = function(){
var time = null,
curDate = null;
if(xhr.readyState===2){
// 获取响应头里的时间戳
time = xhr.getResponseHeader("Date");
console.log(xhr.getAllResponseHeaders())
curDate = new Date(time);
document.getElementById("time").innerHTML = "服务器时间是:"+curDate.getFullYear()+"-"+(curDate.getMonth()+1)+"-"+curDate.getDate()+" "+curDate.getHours()+":"+curDate.getMinutes()+":"+curDate.getSeconds();
}
}
}
</script>获取服务器时间