Here's my (working) example online for you to look at:

http://actingthemaggot.com/test/jquery_example/clock.html

HTH :)


On Apr 22, 10:00 pm, kiusau <kiu...@mac.com> wrote:
> On Apr 22, 9:18 pm, Ricardo <ricardob...@gmail.com> wrote:
>
> > Just add setTimeout(arguments.callee, 1000); to the end of the JSClock
> > function (after this.html...). That way the function will repeat
> > itself over and over every second.
>
> Before I become too concerned about stopping my clock, I must first
> get it running.  At your suggestion I tried the following.
> Unfortunately, this produces the same result as that described in my
> original post.  The only way to advance the clock is to refresh the
> page!
>
> (function($) {
> $.fn.JSClock = function() {
>         function timeFormat(i) {
>                 if (i < 10) {
>                         i="0" + i;
>                 }
>                 return i;
>         }
>         var today=new Date();
>         var h=today.getHours();
>         var m=today.getMinutes();
>         var s=today.getSeconds();
>         m=timeFormat(m);
>         s=timeFormat(s);
>         this.html("Local Time: " + h +":"+ m +":"+s);
>         setTimeout(arguments.callee, 500);
>         }
>
> })(jQuery);
>
> Roddy

Reply via email to