[英]How do I change a counter of the form <h3 id=“counter”>708</h3>?
我有一個帶有計數器的網站,並且具有<h3 id="counter">0</h3>
。 如何更改櫃台號碼? 在哪里可以找到更改?
這是代碼:
<div class="container">
<div class="row">
<div class="col-md-4 project">
<h3 id="counter">0</h3>
<h4>Awesome Projects</h4>
<p>Dolor sit amet, consectetur adipiscing elit quisque tempus eget diam et lorem a laoreet phasellus ut nisi id leo molestie. </p>
</div>
<div class="col-md-4 project">
<h3 id="counter1">0</h3>
<h4>Happy Customers</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit quisque tempus eget diam et. laoreet phasellus ut nisi id leo. </p>
</div>
<div class="col-md-4 project">
<h3 id="counter2" style="margin-left: 20px;">0</h3>
<h4 style="margin-left: 20px;">Professional Awards</h4>
<p>Consectetur adipiscing elit quisque tempus eget diam et laoreet phasellus ut nisi id leo molestie adipiscing vitae a vel. </p>
</div>
</div>
</div>
將以下內容添加到HTML:
<script type="text/javascript">
var count = 0;
// adds 1 to count every 1000 milliseconds and updates it for the user
window.setInterval(function()
{
count++;
document.getElementById("counter").innerHTML = count;
}, 1000);
</script>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.