aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes load array at another time 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 "load array at another time" Watch "load array at another time" New topic
Author

load array at another time

reubin haz
Ranch Hand

Joined: May 12, 2005
Posts: 287
I create an empty array and pass it to some other function that will display it on the page. (its empty yet)
I want to wait 5 seconds and load some elements to the array, which will be displayed onto the page. But don't how to implment it.
I tried this but failed:



SCJA, SCJP5.0, SCBCD, SCWCD
Purushoth Thambu
Ranch Hand

Joined: May 24, 2003
Posts: 425
I tried this and it worked for me.


and I called preload in body onload event. What error/exception you are getting?
reubin haz
Ranch Hand

Joined: May 12, 2005
Posts: 287
What I would like to do is like the code showing below. The page will show the 1st element of the array first, which is 'undefined', after 5 seconds, I want add something to the array, but the page itself does not change. How should I change to make it work? Thanks.

Purushoth Thambu
Ranch Hand

Joined: May 24, 2003
Posts: 425
setTimeout is not a blocking call. You need to rewrite something similar to this:
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: load array at another time