使用下面的代碼,我得到一個clock is not defined
錯誤,爲什麼?x未定義,setTimeout問題
$(function(){
function clock() {
var nd = new Date();
var h, m, s;
h = nd.getHours();
m = nd.getMinutes();
s = nd.getSeconds();
if (h <= 9) h = "0" + h;
if (m <= 9) m = "0" + m;
if (s <= 9) s = "0" + s;
$('#digital-clock .hour').text(h+':');
$('#digital-clock .min').text(m+':');
$('#digital-clock .sec').text(s);
}
setTimeout('clock()', 1000);
});
總是要避免的事情總是要避免。 – Pointy 2010-09-23 15:58:23