This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes how to use setTimeout function Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "how to use setTimeout function" Watch "how to use setTimeout function" New topic
Author

how to use setTimeout function

pravin rasal
Ranch Hand

Joined: Jul 27, 2011
Posts: 63
I have following code




I want to set the value in the text field "text4" by decrementing "no" variable by some second but it didn't working please help me
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63195
    
  69

"didn't work" is not helpful. What did happen? Please show us the complete code and what you tried to do.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15385
    
    6
First problem is $("#text4").val(i) is being executed right away. You need to use a closure/anonymous function.

Eric


pravin rasal
Ranch Hand

Joined: Jul 27, 2011
Posts: 63
i want to display value in text field some interval
pravin rasal
Ranch Hand

Joined: Jul 27, 2011
Posts: 63
In JavaScript I have following code:


If I have no =4000 then I want to display that number in textfield(i.e text4) but after some interval means 4000 -'500ms'-3999-'500ms'-3998-'500ms'...........to -'500ms'-0.
pravin rasal
Ranch Hand

Joined: Jul 27, 2011
Posts: 63
my problem solved
Thanks
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: how to use setTimeout function
 
It's not a secret anymore!