0
我的問題是如何將count1整合到SPAN的「#clickCount」div中?關於使用DOM的javascript/jquery
而不是看起來像:
- 你點擊一個卡上:1,2。(在字符串)次
我希望它看起來像:
- 你點擊一個卡上:(1,2 ....)
換句話說,我想「count1」是div中的自定義跨度。
重要的是要注意,這種刷新每秒鐘。
function pretty_time_string(num) {
return (num < 10 ? "0" : "") + num;
}
var start = new Date;
setInterval(function() {
var total_seconds = (new Date - start)/1000;
var hours = Math.floor(total_seconds/3600);
total_seconds = total_seconds % 3600;
var minutes = Math.floor(total_seconds/60);
total_seconds = total_seconds % 60;
var seconds = Math.floor(total_seconds);
hours = pretty_time_string(hours);
minutes = pretty_time_string(minutes);
seconds = pretty_time_string(seconds);
currentTimeString = hours + ":" + minutes + ":" + seconds;
$("#clickCount").text("You've clicked on a card: " + count1 + " times." + " Correct guesses of pairs: " + count2 + "." + " Play Time: " + currentTimeString);
}, 1000);
我在這個問題上花了5個多小時,還沒有進展。
$("#clickCount").text("You've clicked on a card: " + count1 + " times."
+ " Correct guesses of pairs: " + count2 + "." + " Play Time: "
+ currentTimeString);
你需要這樣的事情嗎? '+(「#clickCount」)。html(「你已經點擊了卡片:」+ count1 +「次。」+「正確猜對成對:」+ count2 +「。」+「播放時間:」 + currentTimeString);' –
謝謝MAN! ! ! !謝謝你不夠... –
不客氣:-) –