似乎无法得到此工作。JavaScript使用全局变量
var current_times = new Date();
var future_times = new Date();
function time(){
current_times = current_times.setMinutes(current_times.getMinutes());
future_times = future_times.setMinutes(future_times.getMinutes() + 1);
}
错误即时得到的是:current_times.getMinutes不是一个函数
笔记肯定,这会有所帮助,但时间功能是从一个身体上的负荷启动的函数调用。
有没有s eem与这段代码有任何问题。你使用的是什么浏览器?正如我所料,我无法在Chrome中重现该问题。 – 2011-04-12 00:03:41
1.您粘贴的特定代码有效。 2.不要将Minute设置为getMinutes()。为什么要这么做?! – Khez 2011-04-12 00:04:19
发布完整的非工作代码示例。 – Hamish 2011-04-12 00:06:22