javascript - How to make my program run continously -


i want make program run continously when done run again after 2 seconds.

heres code :

$(document).ready(function () {  var colorblocks = [     'skip',     'yellow',     'green',     'blue',     'white',     'orange' ]  function colourboard() {     $.each(colorblocks, function (i) {         settimeout(function() {             $('#' + this).css("background", this);             settimeout(function() {                 $('#' + this).css("background", '#212121');             }.bind(this), * 200);         }.bind(this), * 500);     }); } colourboard(); }); 

i sugget using setinterval() this:

var myvar = setinterval(mytimer, 1000);  function mytimer() {     var d = new date();     document.getelementbyid("demo").innerhtml = d.tolocaletimestring(); } 

Comments

Popular posts from this blog

android - net_scheduler holding wakelock -

sql - MySQL : Getting Entries from a many-to-many table -

java - Retrieving data from database using jsp (Hibernate + Spring + Maven) -