5 Replies Latest reply on Aug 4, 2006 4:59 PM by kglad

    creating function

    pmck
      I am creating a counter of Baby Boomers turning 60. My script works (a miraclel!!); see below:

      now = new Date();
      boomer = new Date();
      boomer.setSeconds(0);
      boomer.setMinutes(0);
      boomer.setHours(0);
      boomer.setDate(1);
      boomer.setMonth(0);

      if (now.getTime() > boomer.getTime() )
      {
      diff = now.getTime() - boomer.getTime();
      diff = Math.floor( (diff / 1000 ) * .09 );
      field1 = diff + " boomers have turned 60 since January 1, 2006";
      }

      HOWEVER . . . I want it to update automatically on screen. So I need setTimeout(). And to use setTimeout, I need my code to be a function and I'm not smart enough to convert it to a function. Anything I try gives me a blank screen.

      I could use your assistance. Thank you.