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! ! ! !谢谢你不够... –
不客气:-) –