小提琴:http://jsfiddle.net/bnsex/1/jQuery - 使用.getHours()方法將1-24小時更改爲1-12小時?
我想用2小時時鐘此代碼...
$(document).ready(function() {
setInterval(function() {
var hours = new Date().getHours();
$(".hours, .hour").html((hours < 10 ? "0" : "") + hours);
}, 1000);
});
你的幫助是非常讚賞:d
一切都在你的榜樣。 – Andreas
我將不得不使用If語句,對嗎? –
like if(hours> 12){ hours - = 12; else if(hours === 0){ hours = 12; } ...我幾乎沒有學習jQuery。我需要一些幫助哈哈 –