help| need ssome help.

Discussion in 'JavaScript' started by yuri1992, Mar 14, 2008.

  1. #1
    ok,
    i have one table....
    when i click on one of the td's
    i need that this td change his bgcolor to someelse.

    how i do it ?
     
    yuri1992, Mar 14, 2008 IP
  2. rkquest

    rkquest Well-Known Member

    Messages:
    828
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    140
    #2
    Here..

    
    <table>
    <tr>
    <td onclick="this.style.backgroundColor='#00FF00'">Test</td>
    </tr>
    </table>
    
    HTML:
    Hope that solves your issue. :D
     
    rkquest, Mar 14, 2008 IP
  3. yuri1992

    yuri1992 Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    i do this like that
    echo "<td id=$id-1 style='background-color:red' onclick='this.style.backgroundcolor='blue';'>"; 
    PHP:
    but its dont work
     
    yuri1992, Mar 14, 2008 IP
  4. rkquest

    rkquest Well-Known Member

    Messages:
    828
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    140
    #4
    
    echo "<td id=$id-1 style='background-color:red' onclick=\"this.style.backgroundColor='blue'\">";
    
    Code (markup):
    That should fix it. Be careful with your single and double quotes and its backgroundColor with "C" and not "c".
     
    rkquest, Mar 14, 2008 IP