View Full Version : Selecting Table Rows

01-29-2006, 01:02 PM
Just playing about really, am trying to add the selected table row values to text area. Tried using childNodes but I guess it doesn't work for table rows (just comes out as '[object] - undefined'). Any better methods? - I don't really want an overly complicated solution, afterall it's just testing to get me back into JavaScript again!

<tr class="a" onclick="this.style.backgroundColor='#3D80DF'; this.style.color='#FFF'; document.getElementById('selected_songs').value = document.getElementById('selected_songs').value + this.childNodes[2] + ' - ' + this.childNodes[3] + '\n'">
<td>Slit Wrist Theory</td>
<td>36 Crazyfists</td>

01-29-2006, 01:39 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"


<script language="JavaScript" type="text/javascript">

function Cng(obj){
var t=document.getElementById('selected_songs')
t.value = t.value + objtds[1].innerHTML + ' - ' + objtds[2].innerHTML + '\n'
<tr class="a" onclick="Cng(this);">
<td>Slit Wrist Theory</td>
<td>36 Crazyfists</td>
<textarea id="selected_songs" rows="2" cols="100"></textarea>


01-29-2006, 01:54 PM
Cheers. :thumbsup:

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum