codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  How would I make a cell in a table randomly turn red every 300 ms ?  heather143 at 23:24 on Wednesday, February 13, 2008
 

How would I make a cell in a table randomly turn red every 300 ms ?

--------------------------------------------------------------------------------

Hi, I am very new to Javascript and am having a problem writing this program, so I was wondering if one of you experts could help me. This is the problem I am having. Its probably simple to you guys.

I am trying to do this :

when the "Start" button is clicked a random cell changes its background color to red for 350ms, then back to white, then another cell becomes red, then to a different cell, every 350ms.
It is supposed to be in a 3 x 3 table.
I am trying to get it to work by applying it to the last program i wrote wich is this one:

HTML>
<HEAD>
<TITLE> </TITLE>

<SCRIPT LANGUAGE = "JavaScript">

function clicked(){


if (event.srcElement.style.backgroundColor == "red")
event.srcElement.style.backgroundColor = "white";
else
event.srcElement.style.backgroundColor = "red";
}




</SCRIPT>

</HEAD>

<BODY>
<CENTER>
<TABLE BORDER= "1" HEIGHT= "50%" WIDTH= "50%">

<TR>
<TD ONCLICK="clicked()"> </TD>
<TD ONCLICK="clicked()"> </TD>
<TD ONCLICK="clicked()"> </TD>
</TR>

<TR>
<TD ONCLICK="clicked()"> </TD>
<TD ONCLICK="clicked()"> </TD>
<TD ONCLICK="clicked()"> </TD>
</TR>

<TR>
<TD ONCLICK="clicked()"> </TD>
<TD ONCLICK="clicked()"> </TD>
<TD ONCLICK="clicked()"> </TD>
</TR>


</TABLE>

<INPUT TYPE = "BUTTON" VALUE = "CLICK TO START" ONCLICK = "START()">




</CENTER>

</BODY>

</HTML>

Any help would be greatly appreciated.
Thank you








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  Re: Rewrite this program with good style
•  Re: Non dereferencable iterator C++
•  How would I make a cell in a table randomly turn red every 300 ms ?
•  Displaying First day of the Current Week
•  Displaying First day of the Current Week
•  Reg check after execution of utility from perl script
•  please help me..
•  Opening Music Player Confuses Browser Back Button
•  alert Message messing up


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2008