![]() |
|
|
|
||||||||||
![]() |
|
|
Thread Tools |
|
#1
|
||||
|
||||
|
Can I have multiple window.setTimeout calls?
I'm just updating ad scripts on a client site and they've got multiple window.setTimeout's being set as different ads rotate.
To start with they were using the same function names and that was causing problems. But even with everything fixed only one will rotate which leads me to suspect that window.setTimeout can only be used once! Can anyone verify that? Places I've been hunting:
|
|
#2
|
|||
|
|||
|
I think you overwrite it, each time you use it. Just like window.load. You need to use a wrapper function to set it, just like addLoadEvent.
|
|
#3
|
|||
|
|||
|
You can use setInterval instead. If you have to use setTimeout, use something like this:
javascript Code:
J.D. Last edited by digitalpoint; Sep 4th 2005 at 7:14 pm. Reason: Added JavaScript BBCode |
|
#4
|
||||
|
||||
|
I thought you could assign timeouts to variables, and have more than one.
Might want to test if you are interested. hth, tom |
|
#5
|
||||
|
||||
|
Hmm, thanks for the replies
went to test it out using the devguru script with changes html4strict Code:
Last edited by digitalpoint; Sep 4th 2005 at 7:15 pm. Reason: Added HTML BBCode |
|
#6
|
|||
|
|||
|
How setTimeout is scheduled is browser-specific. For example, if you try this code in FF, it will bring up two alerts immediately, but then will pop a new one only after you dismiss some or all of the existing alerts. IE will create just one at a time.
javascript Code:
Don't dismiss the alerts, but instead just move them to see what I mean. It appears that setInterval works the same way. J.D. Last edited by digitalpoint; Sep 4th 2005 at 7:15 pm. |
![]() |
| Bookmarks |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Generating Phone Calls | mr_tim | General Marketing | 10 | Mar 10th 2006 7:59 pm |
| Accessing a element of parent window in child window | livehed | Programming | 0 | Jun 28th 2005 7:49 am |
| setTimeout() problem | st3v1nsk1 | JavaScript | 1 | Apr 21st 2005 1:03 pm |
| Sales calls.... | ROAR | General Chat | 7 | Feb 11th 2005 9:53 am |
| Multiple Browsers Window Injection Vulnerability | mushroom | General Chat | 3 | Dec 9th 2004 11:09 am |