发布网友 发布时间:2022-04-22 08:20
共2个回答
热心网友 时间:2022-06-18 12:44
<span class="s">15</span>
<script>
var doc = document.getElementsByClassName('s')[0];
var prev;
setInterval(function () {
prev = parseInt(doc.innerHTML);
doc.innerHTML = prev + 1;
},1000)
function judgement() {
setTimeout(function () {
var next = doc.innerHTML;
if (prev > next) {
console.log("减少");
}else{
console.log("增长");
}
},2000)
}
judgement();
</script>
热心网友 时间:2022-06-18 12:44
用末位值减去初始值