Change background color of cell on radio button click
Posted: Mon Aug 06, 2007 11:03 pm
feyd | Please use
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I am new to PHP and was wondering how I can change the background color of a table cell. When a radio button is clicked, I want the cell next to the cell that contains the radio button to change the background color.
I tried assigning id's to the 'td' lines but that didn't seem to work. Help would be appreciatedCode: Select all
function occlude(object_id) {
// below are some of my attempts
??? document.getElementById(xxx).style.backgroundcolor = "yellow";
??? document.getElementById(xxx).setAttribute('className','bgYellow');
}
echo "<tr>";
echo "<td width='22px' align='center'>";
echo "<input type='radio' name='btnradio:$taskid' onclick=\"[color=red]javascript:occlude('rec:$taskid')[/color]\" value='0'></td>";
if ($row["RecordExists"] == "0") {
echo "<td class='bgRed' width='22px'>";
echo "<input type='radio' name='btnradio:$taskid' onclick=\"javascript:reveal('rec:$taskid')\" value='1'></td>\n";}
else { echo "<td class='bgYellow' width='22px'>";
echo "<input type='radio' name='btnradio:$taskid' onclick=\"javascript:reveal('rec:$taskid')\" value='1' CHECKED></td>\n";}feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]