Your question is easiest to answer with code for me. They key is that
each row needs an individual id. If you are outputting a query for the
table, the query.currentRow variable works fine.

This code should silently fail in NS4, but should work fine in IE4+,
Moz family, and Opera 6+.

<script>
var ns4 = document.layers? true : false;
var ie = document.all? true : false;
var dom = document.getElementById && !document.all ? true : false;
//stores currently highlighted row id
var highlightedRow = '';

//gets dom object
function getObject(nameStr) {
    if (dom)
        return document.getElementById(nameStr);
    else if (ie)
        return document.all[nameStr];
    else if (ns4)
        return document.layers[nameStr];
}

function highlight(rowID) {
        unHighlight();
        rowObj = getObject(rowID);
        rowObj.style.background = '#00ccff';
        highlightedRow = rowID;
}

function unHighlight() {
        if (highlightedRow != '') {
                rowObj = getObject(highlightedRow);
                rowObj.style.background = '#ffffff';
        }
}
</script>
<form>
<table width="400">
        <tr id="row1">
                <td>date</td>
                <td>time</td>
                <td>loc</td>
                <td><input type="radio" name="selected" value="1" 
onclick="highlight('row1')"></td>
        </tr>
        <tr id="row2">
                <td>date</td>
                <td>time</td>
                <td>loc</td>
                <td><input type="radio" name="selected" value="1" 
onclick="highlight('row2')"></td>
        </tr>
</table>
</form>

-- 
jon
mailto:[EMAIL PROTECTED]

Wednesday, September 4, 2002, 9:24:23 PM, you wrote:

CM> Hi,

CM> This is not exactly CF related but since it is on a CF page, I thought I would ask 
anyway.

CM> I need to hightlight a table row when the user clicks on radio button, basically 
each row has 4 cells (Date, Time, Location, Register(RadioButton)) and when the user 
click on the radiobutton the
CM> table row will hightlight and if the click on a different radiobutton that row 
hightlights and the previous selected one returns to normal(white) - something like 
Yahoo does with the checkbox in
CM> the mail - check the box and the table row turns blue - uncheck and it turns white.

CM> I have been able to get just the cell that the radio button is in to hight but I 
cannot get the entire row.

CM> Thanks

______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to