Demo of modulus function resetting incremental counter in JavaScript

var speed=1000; // For one second duration it is 1000
var counter_value=30; // change this value
var ms=0;
function my_function(){
document.getElementById("d1").innerHTML="<h2>"+ ms + "</h2>"; // display the counter
ms=ms+1; // increment by 1
if(ms % counter_value ==0){
//timer to trigger my_function() at an interval of millseconds set by speed valirable//

Post your comments , suggestion , error , requirements etc here .

We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2020 All rights reserved worldwide Privacy Policy Disclaimer