[thelist] Minimising the window and IE pop up windows

.jeff jeff at members.evolt.org
Thu Jan 24 04:22:03 CST 2002


paul,

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> From: Paul Backhouse
>
> So basically a new timer is started, this redirects to
> a process page that writes the result every so often,
> this then redirects back to timer page and collects the
> previous result (time) from the database - the issue is
> starting it from here (ie: 32 minutes and 15 seconds
> etc...), so it appears seemless - any idea?
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

you'll also have issues where the amount of time between the initiation of
the redirect and the resulting page loading in the browser not being
accounted for.

to handle the counting, just have two inputs -- one for minutes and one for
seconds.  the serverside scripts sets the values.  have some javascript that
runs with setInterval() to execute once every 1000 milliseconds.  all this
script does is checks that the seconds is less than 59 and increases it by
1.  if it's 59, it sets it to 0 and increases the minutes by 1.


function ticktock()
{
  var form = document.forms[0];
  seconds = parseInt(form.seconds.value);
  if(seconds < 9) form.seconds.value = 0 + seconds++;
  else if(seconds < 59) form.seconds.value = seconds++;
  else
  {
    minutes = parseInt(form.minutes.value);
    form.seconds.value = 00;
    form.minutes.value = minutes++;
  }
}

function init()
{
  setInterval('ticktock()', 1000);
}

window.onload = init;


if this application needs to be able to count for more than 60 minutes, i'd
suggest adding an "hour" input as well and adding the necessary logic to the
function above.

good luck,

.jeff

http://evolt.org/
jeff at members.evolt.org
http://members.evolt.org/jeff/






More information about the thelist mailing list