Jump to content

deepak4279

Members
  • Posts

    1
  • Joined

  • Last visited

About deepak4279

  • Birthday 05/15/1989

Previous Fields

  • Languages
    English

Profile Information

  • Location
    Bangalore, India

deepak4279's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Hii I am trying to color the background of a table data..when the output is equal to the "id" of td. and when the output repeats i want to skip that..i.e i dnt want any repeatation in the output..and i want each output after 1 second interval..plz help me out.This is my piece of code. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title></head><link href="1.css" type="text/css" rel="stylesheet" /><div id="table"> <table bgcolor="#FF0000";> <tr> <td id="1">1</td> <td id="2">2</td> <td id="3">3</td> <td id="4">4</td> <td id="5">5</td> <td id="6">6</td> <td id="7">7</td> <td id="8">8</td> <td id="9">9</td> <td id="10">10</td> </tr> <tr> <td id="11">11</td> <td id="12">12</td> <td id="13">13</td> <td id="14">14</td> <td id="15">15</td> <td id="16">16</td> <td id="17">17</td> <td id="18">18</td> <td id="19">19</td> <td id="20">20</td> </tr> <tr> <td id="21">21</td> <td id="22">22</td> <td id="23">23</td> <td id="24">24</td> <td id="25">25</td> <td id="26">26</td> <td id="27">27</td> <td id="28">28</td> <td id="29">29</td> <td id="30">30</td> </tr> </table></div><script>var int;var x;function color(){do{int=Math.floor(Math.random()*100);}while(int>30)if(int==0)color();x=document.getElementById(int).style.backgroundColor;if(x== "orange")color();else{document.writeln(int);document.getElementById(int).style.backgroundColor="orange";}}//for(i=0; i<100; i++){setInterval(color(), 1000);//color();//if(i == 99)//i=0;//}</script><div id="results"></div><body></body></html> Thanks in advance.
×
×
  • Create New...