Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 22nd, 2003, 02:35 PM
Friend of Wrox
Join Date: Jun 2003
Location: , , USA.
Posts: 101
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Moharo
Default javascript functions

hello there fellows

i got a question regarding functions in JavaScript. how can i stop executing a function
which calls itself using setTimeout() method. For example, consider following functions:

var time = 0;

function start()
    //start the timer
    setTimeout("start(" + time + ")",1000);

function resetTimer()
    time = 0;
    return time;

now if i call the start() function for the first time, there's no problem but when i call resetTimer() and then again start() function,
the timeout seems to be going crazy fast - it doesn't increment time variable every second but it gets a lot faster. Every time i call start() function, time variable gets increased much faster every 1 second. I think you know what i mean. what i want is to call start function even million times but still the time variable will increase every second.

thanx :D:D

the genuine genius
www.campusgrind.com - college portal
Reply With Quote
  #2 (permalink)  
Old September 23rd, 2003, 01:04 AM
Friend of Wrox
Points: 3,558, Level: 25
Points: 3,558, Level: 25 Points: 3,558, Level: 25 Points: 3,558, Level: 25
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: California, USA
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik

I had no problem! of course by changeing a liitle bit ur code!!!
1. u used the start by argument but there is no parameter in creation!
2. u can use start function in setTimeout() without any () like: setTimeout(start, 1000);
3. I had problem in using start name for my function. what is ur Browser & version?!

Hovik Melkomian.
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript functions and xslt 1.0 variable mlohokare XSLT 18 December 3rd, 2008 02:22 AM
stop current javascript function using javascript sakthi Javascript 3 June 2nd, 2008 03:30 PM
Dynamically call javascript functions austinf Javascript 1 May 13th, 2006 07:31 AM
functions xelepi PHP How-To 1 March 10th, 2006 02:59 AM
Executing from JavaScript C# functions see07 ASP.NET 1.x and 2.0 Application Design 1 March 1st, 2005 07:02 PM

All times are GMT -4. The time now is 04:01 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.