Hi in my javascript i need to increase an int value by one after every 5 seconds. How to do this? The script should keep increasing until the user moves away from the page.
yaragalla_mural 0 Newbie Poster
Recommended Answers
Jump to PostThis could be easily done using the setInterval() method.
Simple example...
<span id="total">0</span> <script> var x = 0; var int=self.setInterval(function(){count()},5000); function count(){ x++; document.getElementById("total").innerHTML=x; } <script>
Try on jsFiddle
All 2 Replies
JorgeM 958 Problem Solver Team Colleague Featured Poster
yaragalla_mural commented: Thanks +3
yaragalla_mural 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.