SitePoint Sponsor |
|
User Tag List
Results 1 to 2 of 2
Thread: Change <td> color via dropdown
-
Sep 13, 2007, 06:02 #1
- Join Date
- Apr 2007
- Posts
- 211
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Change <td> color via dropdown
The following code only changes the color around the drop down menu and not the entire cell.
Code:Choose a background color for this table cell:<br /> <select onChange="this.parentNode.style.backgroundColor = this.options[this.selectedIndex].value;" name="bg_color_cell2" size="1"> <option value="">-- Select a color --</option> <option style="background-color: #ffffff;" value="#ffffff">#ffffff</option> <option style="background-color: #ffff99;" value="#ffff99">#ffff99</option> <option style="background-color: #ccff99;" value="#ccff99">#ccff99</option> <option style="background-color: #ffcc99;" value="#ffcc99">#ffcc99</option> <option style="background-color: #cccc33;" value="#cccc33">#cccc33</option> <option style="background-color: #66cc99;" value="#66cc99">#66cc99</option> </select>
-
Sep 13, 2007, 08:11 #2
- Join Date
- Apr 2007
- Posts
- 211
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Code:onChange="this.parentNode.parentNode.style.backgroundColor = this.options[this.selectedIndex].value;"
Bookmarks