NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Help! setTimeout not working with random number

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search
5 members in live chat ~  


Reply
 
LinkBack Thread Tools
Old 08-03-2009, 05:12 PM THREAD STARTER               #1 (permalink)
NamePros Member
 
traderone's Avatar
Join Date: Apr 2005
Location: N.C.
Posts: 186
traderone will become famous soon enoughtraderone will become famous soon enough
 



Help! setTimeout not working with random number


Hello,
????: NamePros.com http://www.namepros.com/programming/600886-help-settimeout-not-working-random-number.html
I can not seem to get this to work. It is a recursive function that calls itself. It is supposed to delay 10 seconds plus a random amount. The problem I'm having is that it repeatedly calls itself every 10 seconds (exactly) without adding a random number of seconds.

Code:
var i=0;
function load(){
.....
	i++;														
	if (i<=someArray.length){
		timer=setTimeout("load()", (10000 + Math.floor(Math.random()*10*1000)));							
	}
}
traderone is offline   Reply With Quote
Reply

Tags
javascript timeout


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


 
All times are GMT -7. The time now is 02:30 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger