Change table values with radio buttons

Fatbat

Advertise Here
May 10, 2008
6,994
149
0
Costa del Sol, Spain
www.deepbass.com
I have a form containing 3 radio buttons followed by a table that is 5 rows by 5 columns. I need the 5 values in one of the columns to change depending on which of the 3 radio buttons is selected using JS/jQuery.

I've been searching for hours for a way to do this and haven't found what I am looking for. If you can point me in the right direction it would be appreciated.
 


If you have exausted all options outsource the issue to elance, fiver. You should never waste hours on stuff like this outsource will save you alot of headaches.
 
If you have exausted all options outsource the issue to elance, fiver. You should never waste hours on stuff like this outsource will save you alot of headaches.

Fiver maybe, but I could spend hours just vetting someone on elance, Odesk, etc. I'm sure I'm really close as well, it's just not working for me. I have someone on the west coast that can probably help, bet they are still sleeping ATM.
 
Here. Was even a nice guy, and tested it for ya:

Code:
<script type="text/javascript">
     function changeTableCol(table_id, col1, col2) {         
          var table = document.getElementById(table_id);
          for (x=0; x < table.rows.length; x++) {
             var old_value = table.rows[x].cells[col1].innerHTML;
             table.rows[x].cells[col1].innerHTML = table.rows[x].cells[col2].innerHTML;
             table.rows[x].cells[col2].innerHTML = old_value;
          }
     }
</script>
Then example HTML code:

Code:
<form action="#">

<table id="mytable">
<tr>
    <th>ID</th>
    <th>Username</th>
    <th>Name</th>
    <th>E-Mail</th>
</tr><tr>
    <td>4</td>
    <td>test</td>
    <td>Test Account</td>
    <td>test@test.com</td>
</tr><tr>
    <td>1</td>
    <td>jsmith</td>
    <td>John Smith</td>
    <td>jsmith@aol.com</td>
</tr></table>

<br><br>
<input type="radio" name="action" value="1" onclick="changeTableCol('mytable', 1, 2);">Change Username to Name<br>
<input type="radio" name="action" value="2" onclick="changeTableCol('mytable', 3, 2);">Change E-Mail to Name<br>
</form>

EDIT: Sorry read your OP wrong. Thought you meant switch the ordering of two columns.