javascript - setInterval() for an analogue clock -


i'm quite new javascript , have trouble working etinterval().

i'm creating analogue clock exercise. have function settime() gets , displays time rotating arrows accordingly.

i want execute function again , again.

here code :

    $(document).ready(function(){          function settime(){             var d = new date();             var hour = d.gethours();             var minute = d.getminutes();             var hourrotation = hour * 30 + (minute / 2);             var minuterotation = minute * 6;             $("#small").css({                 "-webkit-transform": "rotate(" + hourrotation + "deg)",                 "-moz-transform": "rotate(" + hourrotation + "deg)",                 "-o-transform": "rotate(" + hourrotation + "deg)"             });             $("#big").css({                 "-webkit-transform": "rotate(" + minuterotation + "deg)",                 "-moz-transform": "rotate(" + minuterotation + "deg)",                 "-o-transform": "rotate(" + minuterotation + "deg)"             });         };         function clockstart(){             setinterval(settime(),1000);             settime();         }         clockstart();     }); 

i'd understand method , how use it. examples find looked obvious, still can't make work.

you making function call in setinterval().

what want :

setinterval(settime,1000); 

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -