473,396 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

rounding up a bunch of setTimeouts

ctoz
13
With a lot of help, I've arrived at a function which changes two styles on a single element:

Expand|Select|Wrap|Line Numbers
  1. function boxDC (boxname,display,color) {
  2.     box = document.getElementById(boxname);
  3.     box.style.display = display;
  4.     box.style.color = color;
  5. }
  6.  
This is to be applied to a bunch of divs at regular intervals. I can do it primitive:

Expand|Select|Wrap|Line Numbers
  1. function fireOne() { 
  2. boxDC('jim','block','white');
  3. setTimeout('boxDC(\'jon\',\'block\',\'white\') ' ,60);
  4. setTimeout('boxDC(\'tom\',\'block\',\'white\') ' ,120);
  5. }
but the bunch is bigger than 3 divs. So it looks like an array is needed, and a loop, which is where I'm having problems:

Expand|Select|Wrap|Line Numbers
  1. function fireOne() {
  2. // 32 divs
  3.  oneWhite = new Array("jim","jon","tom", ... thru to "bob");
  4.  
  5. function boxDC (boxname,display,color) {
  6.     box = document.getElementById(boxname);
  7.     box.style.display = display;
  8.     box.style.color = color; 
  9. }
  10.  
  11.  for (i = 0; i < oneWhite.length; i++)  {
  12. setTimeout('boxDC(\'boxname\',\'block\',\'white\')', 60) 
  13. }
  14. }
looks close, but no cigar so far.

cheers

CT
Aug 19 '07 #1
1 1013
gits
5,390 Expert Mod 4TB
hi ...

in your loop:

Expand|Select|Wrap|Line Numbers
  1. oneWhite[i]
  2.  
is your desired boxname instead of 'boxname' ;)

kind regards
Aug 19 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: DaveK | last post by:
I am upgrading an MS Access 97 application which uses the format function to round decimal numbers to two places e.g. format(dblValue, "standard") Having done an initial study of this...
4
by: spebola | last post by:
I am using vb.net 2003 professional and I get the following results when using the round method: dim Amount as decimal = 180.255 Amount = Amount.Round(Amount, 2) Amount now contains 180.25. ...
15
by: Br | last post by:
Cint(3/2) = 2 (rounded up, I would have thought the answer would be 1) Cint(5/2) = 2 (rounded down) The Access help says Cint() rounds to the nearest even number, but why?? Do I need to...
11
by: cj | last post by:
Lets assume all calculations are done with decimal data types so things are as precise as possible. When it comes to the final rounding to cut a check to pay dividends for example in VB rounding...
8
by: erbrose | last post by:
Hey all, still a newbie to perl and programming and still needing some advice.. I have a ".CSV" table that I need to do some (rounding) manipulation on. the table looks something like this.. (the...
18
by: jdrott1 | last post by:
i'm trying to round my currency string to end in 9. it's for a pricing application. this is the function i'm using to get the item in currency: FormatCurrency(BoxCost, , , , TriState.True) if...
206
by: md | last post by:
Hi Does any body know, how to round a double value with a specific number of digits after the decimal points? A function like this: RoundMyDouble (double &value, short numberOfPrecisions) ...
20
by: jacob navia | last post by:
Hi "How can I round a number to x decimal places" ? This question keeps appearing. I would propose the following solution #include <float.h> #include <math.h>
2
Pittaman
by: Pittaman | last post by:
Hello I am creating some crystal reports (for visual studio 2005) based on the content of certain .NET objects. I'm doing this in .NET 2.0. For one of them I'm using a Cross-table to summarize...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.