似乎無法得到此工作。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