Click to See Complete Forum and Search --> : Color changing etc


n@@by
10-16-2003, 02:03 PM
I have quit a complex problem, and not too much experience with java script. So.... I'm looking for some help.

Here's my problem:

Every minute I need a function to be executed. It needs to check every row in a table on the page and change the color of that row if the time of that row is past the current time.
What would the function look like (more or less), considering my tabel is dynamically generated and never the same. What would be needed in the table (what should be named.... how can I assign a time to a row? in its name?)?

Jona
10-16-2003, 02:12 PM
What you would do is run a setTimeout() function every minute, that will call a function. This function will select the table by its ID (document.getElementById("tableID")) and determine the "time value" of the table in one of many ways. You could use <div id="dynamic_number_for_the_div"></div> and fill it in with the time value inside of the table, and use document.getElementById("tableID").childNodes[x] where x is a variable in a for() loop checking to see if childNodes[x] is a DIV, and if so, if its ID is appropriate and corresponds with the currently selected table. Once you retrieve the value, you will set the highlighted DIV's parentNode's style.backgroundColor and set it to the name of the color you want or RGB color.

[J]ona

n@@by
10-17-2003, 04:15 AM
Thank you. I was able to figure it out becuase of the info you gave me. I got it all working ;)

Jona
10-17-2003, 08:19 AM
I'm glad to be of assistance, and am also glad that you did it on your own. Well done! :)

[J]ona