/    Sign up×
Community /Pin to ProfileBookmark

How can I have the timer continue counting after the alert?

The following script is a counter that counts up and when a specific time has been reached, the user is alerted with a message.

What I want to do is have the timer continue counting while the end user sees the alert…

Thanks in advance.

<SCRIPT LANGUAGE=”JavaScript”>

var up;
var min1,sec1;
var cmin1,csec1,cmin2,csec2;

function Minutes(data)
{
for(var i=0;i<data.length;i++) if(data.substring(i,i+1)==”:”) break;
return(data.substring(0,i));
}

function Seconds(data)
{
for(var i=0;i<data.length;i++) if(data.substring(i,i+1)==”:”) break;
return(data.substring(i+1,data.length));

}

function Display(min,sec)
{
var disp;
if(min<=9) disp=” 0″;
else disp=” “;
disp+=min+”:”;
if(sec<=9) disp+=”0″+sec;
else disp+=sec;
return(disp);
}

function Up()
{
cmin1=0;
csec1=0;
min1=0+Minutes(document.sw.beg1.value);
sec1=0+Seconds(document.sw.beg1.value);
UpRepeat();
}

function UpRepeat()
{
csec1++;
if(csec1==60) { csec1=0; cmin1++; }
document.sw.disp1.value=Display(cmin1,csec1);
if((cmin1==min1)&&(csec1==sec1)) alert(“YOUR TIME IS UP!”);
up=setTimeout(“UpRepeat()”,1000);

}

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@KorDec 19.2003 — Use a popup instead of an alert... Or better, use a hidden/visible layer with your text alert message.
×

Success!

Help @Rashar spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...