看我的例子。脚本应该将变量设置为零,然后每秒加 1。相反,该值每秒翻一番。有人知道出了什么问题吗?
<script>
function count_it()
{
window.counts = window.counts+1;
$('.result').html(window.counts);
window.setInterval(count_it, 1000);
}
$('document').ready(function(){
window.counts = 0;
count_it();
});
</script>