Go Back   CodingForums.com > :: Server side development > Other server side languages/ issues > ColdFusion

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-26-2011, 03:50 PM   PM User | #1
eddyzhuo
New to the CF scene

 
Join Date: Oct 2011
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
eddyzhuo is an unknown quantity at this point
Question How to loop to run a piece of code every second?

Can anyone show me a simple Coldfusion code to loop to run a piece of code every second? Thank you so much.
eddyzhuo is offline   Reply With Quote
Old 10-27-2011, 06:08 AM   PM User | #2
Gjslick
Regular Coder

 
Join Date: Feb 2009
Location: NJ, USA
Posts: 476
Thanks: 2
Thanked 70 Times in 69 Posts
Gjslick will become famous soon enough
Not sure why you'd want to, but:
Code:
<cfloop from="1" to="5" index="i">
  <cfoutput>#i#</cfoutput>
  <cfset sleep( 1000 )>  <!--- Sleep for 1 second (1000ms) --->
</cfloop>
-Greg
Gjslick is offline   Reply With Quote
Old 10-27-2011, 06:09 AM   PM User | #3
Gjslick
Regular Coder

 
Join Date: Feb 2009
Location: NJ, USA
Posts: 476
Thanks: 2
Thanked 70 Times in 69 Posts
Gjslick will become famous soon enough
Btw, you'll need ColdFusion 8 or higher for that.

-Greg
Gjslick is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:53 AM.


Advertisement
Log in to turn off these ads.