Jump to content

JS Timer


ueharataichou

Recommended Posts

Here's the code before the explanation of my problem:

function dotimer()

{

today=new Date()

slutsec=today.getSeconds()

slutmin=today.getMinutes()

sluttim=today.getHours()

sluta=(slutsec) + 60 * (slutmin) + 3600 * (sluttim)

diff=sluta - starta

tim=Math.floor(diff / 3600)

min=Math.floor((diff / 3600 - tim) * 60)

sek=Math.round((((diff / 3600 - tim) * 60) - min) * 60)

document.timerform.timer.value=tim + ':'

if(min<10)document.timerform.timer.value+='0'

document.timerform.timer.value+=min + ':'

if(sek<10)document.timerform.timer.value+='0'

document.timerform.timer.value+=sek

window.setTimeout("dotimer()",speed)

}

function Timer()

{

today=new Date()

startsek=today.getSeconds()

startmin=today.getMinutes()

starttim=today.getHours()

starta=(startsek) + 60 * (startmin) + 3600 * (starttim)
/*
document.write('<form name=timerform><input name=timer size=7')

document.write('></form>')
*/
dotimer()

}

<form id="timerform" name="timerform">
<input type="text" name="timer" size="7" id="ttime" />
</form>

 

Let's say I get a time of "00:34:51" and at a click of a button I'll proceed next page while retaining the value "00:34:51" and continuing the count on that page..how?  :shrug:

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.