Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "Julio P. Di Egidio" Newsgroups: comp.lang.javascript Subject: Re: setInterval Date: Tue, 7 Feb 2017 06:22:25 +0100 Organization: A noiseless patient Spider Lines: 1 Message-ID: References: <6cb902b0-8913-4b65-954d-5d9f0e60ee95@googlegroups.com> <4cbfae02-e217-436d-8c41-004de444915c@googlegroups.com> <8e741582-e2a8-4713-b49d-6bd5a50a8317@googlegroups.com> <87h947e7f5.fsf@bsb.me.uk> <82f4ba9f-8d80-4769-842a-5a9b066efb5a@googlegroups.com> <5898e78d$0$18070$e4fe514c@newszilla.xs4all.nl> <3141f801-2946-40fc-87ad-97668f7061e4@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset="UTF-8"; reply-type=original Content-Transfer-Encoding: 7bit Injection-Date: Tue, 7 Feb 2017 05:20:44 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="1c2715a88b56e96fd2e61ad2b5361d25"; logging-data="32565"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19mqctVnIvOFDmKiJaZoylH+28fK7NsRwk=" X-MimeOLE: Produced By Microsoft MimeOLE V16.4.3528.331 In-Reply-To: X-Newsreader: Microsoft Windows Live Mail 16.4.3528.331 Importance: Normal Cancel-Lock: sha1:77D0znWu2p1uihA4dOGKbEioPOg= X-Priority: 3 X-MSMail-Priority: Normal Xref: csiph.com comp.lang.javascript:32529 wrote in message news:c8d749e4-8813-498c-a763-bc345854732d@googlegroups.com... > > function INTRO(){ > mycount=25; > document.getElementById('mysubset').selectedIndex=1; > while (mycount>-1){ > refresh = setTimeout("COUNTDOWN();",200); > mycount--; > } > } > > One would think that this would set a timeout 26 times and call the > function COUNTDOWN, but that is not what it does. That is not what one would think... Here is a working example for your perusal. Study the language, read e.g. Crockford's articles, and read the JS spec while you code, best on MDN in my opinion. Then feel free to ask questions. ---------------------------------------------- Countdown sample

Count value: 0

---------------------------------------------- HTH, Julio