Hi,

I'm dealing with 2 tables, one has a dynamically created 'price' via javascript that I want to transfer to the cell of another table. Bascailly I want to add an onclick event to the cell in table 1 and having it fire a function that uses an id that is defined on the cell in table 2.

Does anyone have any idea how to do this? I can't even seem to get the onclick part working

Table 1 is coded as follows:

<script type="text/javascript">
function setEvent(){
var ids = [1];
for(var j=0;j<ids.length;j++){
var rows=document.getElementById(ids[j]).getElementsByTagName('tr'), i=1, r;
while(r=rows[i++]){
i<rows.length?r.onclick=doActions:null;
}
}
function doActions(){
var rows=this.parentNode.getElementsByTagName('tr'), i=1, r, c, v;
var th=this.parentNode.parentNode.getElementsByTagName('th');
while(r=rows[i++]){
if(r==this){
r.style.backgroundColor='#ccc';
c=this.getElementsByTagName('td');
v=c[c.length-1].firstChild.data;
th[th.length-1].getElementsByTagName('p')[0].firstChild.data=v;

}
else{r.style.backgroundColor=''}
}
}
}
onload=setEvent;

</script>

<table cellpadding="3" cellspacing="1" class="basket_options_table" id="1">
<tr>
<tr>
<th>Usage</th>
<th>Resolution</th>
<th>File Size</th>
<th>Price</th>
</tr>
</tr>

<tr class="normal" onmouseover="this.className='normalon'" onmouseout="this.className='normal'" onclick="getValue()" >
<td>FREE</td>
<td>320 x 288 pixels</td>
<td>size</td>
<td>&pound;0</td>
</tr>
<tr class="normal" onmouseover="this.className='normalon'" onmouseout="this.className='normal'" onclick="getValue()" >
<td>Personal Use</td>
<td>320 x 288 pixels</td>
<td>size</td>
<td>&pound;5</td>
</tr>

And table 2 is:

<table cellpadding="0" cellspacing="0" ><tr>
<td class="your_order_item">
<p><a href="record_link_goes_here"></a></p>
</td>


<td class="your_order_item">
<p>&pound;"price goes here"</p>
</td>


</tr>
<table>

Thanks