• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

changing table cell bgcolor

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi;
i want to change the background color of a <td> cell when the user clicks on it.
i tried to do:
<td onklick="bgcolor='#FFFFFF'"<

(i spelled click with a 'k' on purpose because it wont post otherwise)

i also tried:
<td onklick="this.bgcolor='#FFFFFF'"<

i also tried:
<td onklick="changeColor()"<

where i declared a function:

function changeColor(){
event.srcElement.bgcolor="#FFFFFF"
}



none of these options worked.

What am I doing wrong?
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
look at the 3rd and 4th example here: http://radio.javaranch.com/pascarello/2004/12/30/1104419159000.html

Eric
 
Kieth Nogins
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks eric, it did the trick
reply
    Bookmark Topic Watch Topic
  • New Topic