set parameter problem

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
valen53
Forum Contributor
Posts: 137
Joined: Tue Aug 27, 2002 9:29 am

set parameter problem

Post by valen53 »

i have a function countDown()

function countDown(minit,second)
{
.......
counter=setTimeout("countDown()", 1000);
}

the problem is how to put parameter into function ?
any bracket or comma want to add in "minit,second" ?
something like this:
counter=setTimeout("countDown(minit,second)", 1000);
valen53
Forum Contributor
Posts: 137
Joined: Tue Aug 27, 2002 9:29 am

Post by valen53 »

i make it more clear at here.
actually i ask about java script thing.

Code: Select all

function countDown(me,se ){
countDownTime = se ;
++countDownTime;

if (countDownTime >=10){
countDownTime=countDownInterval;
clearTimeout(counter)
Tminit++
countDown() ;
return
}
counter=setTimeout("countDown()", 1000);    ----- problem here
}
In problem here, i dunno how to set parameter into function :

counter=setTimeout("countDown()", 1000);
User avatar
andre_c
Forum Contributor
Posts: 412
Joined: Sun Feb 29, 2004 6:49 pm
Location: Salt Lake City, Utah

Post by andre_c »

you should be able to do it, just get rid of the quotes.
valen53
Forum Contributor
Posts: 137
Joined: Tue Aug 27, 2002 9:29 am

Post by valen53 »

counter=setTimeout("countDown(" + me + ", " + se + ")", 1000);
Post Reply