Hi I am new here and also not very good at javascript at all
I want to set an attribute called scope with a value row for the first cell in the first 2 columns.
I was able to set this successfully using the JavaScript code underneath, however due to the use of rowspan the first 2 cells is not always the right one to set I want to set xes only in the country and city column. I need to somehow to do this take into account the rowspan attribute and set only the country and city column.

here is the function.

function testColum(){
var colsToAddScope = 2;
allNodes = document.getElementsByClassName("ResultsTable");
for(i=0;i < allNodes.length;i++) {

// Set the scope attribute of the right columns
if (allNodes[i].hasChildNodes()){
// Get the rows of the table
allTrElements = allNodes[i].getElementsByTagName("tr");
for(j=0;j < allTrElements.length;j++) {
// Get the columns of the row
allTdElements = allTrElements[j].getElementsByTagName("td");
for(k=0;k < allTdElements.length ;k++) {
// Set the scope tag for the appropriate columns
if (k<colsToAddScope){

allTdElements[k].innerHTML = "x";



HERE is the table:

<table id="saw_6063_2" class="ResultsTable" onmouseover="RTOver(event)" onmouseout="RTOut(event)" title="Results" border="4" cellpadding="2" cellspacing="0">
<th>Account Name</th>
<th> Internal Name
<th scope="col" class="ColumnHdgSortable" >Street Address</th>
<th dir="ltr" scope="col" class="ColumnHdgSortable" >ROW_ID</th>
<td dir="ltr" scope="row" rowspan="3">BE</td>
<td dir="ltr" rowspan="2">BRUXELLES</td>
<td dir="ltr"></td>
<td dir="ltr">Fortis Banque s #Fortis Bank nv</td>
<td dir="ltr">FORTIS - HQ</td>
<td dir="ltr">Rue Montagne du Parc 3 1GA1E</td>
<td dir="ltr">12KX+FUZ+360</td>
<td dir="ltr">
<td dir="ltr" >
Toyota Motor Europe nv#Toyota Motor Europe sa</td>
<td dir="ltr" >TOYOTA - HQ</td>
<td dir="ltr" >Avenue du Bourget 60</td>
<td dir="ltr" >12KX+FQA+4792</td>
<td dir="ltr" >RONSE</td>
<td dir="ltr" ></td>
<td dir="ltr" >Associated Weavers
Europe nv</td>
<td dir="ltr">Associated Weavers Europe
nv - HQ</td>
<td dir="ltr" >Industriepark Klein
Frankrijk 1</td>
<td dir="ltr" >12KX+FVF+1186</td>
<td dir="ltr" scope="row" rowspan="7">FR</td>
<td dir="ltr">BAGNOLET</td>
<td dir="ltr"></td>
ET FILS</td>
<td dir="ltr" >DARTY - HQ</td>
<td dir="ltr" >40 RUE JEAN JAURES
<td dir="ltr">12KX+2QN+4569</td></tr>
<tr><td dir="ltr">BEAUSEMBLANT</td>
<td dir="ltr">
<td dir="ltr">NORBERT DENTRESSANGLE</td>
<td dir="ltr">NORBERT DENTRESSANGLE - HQ</td>
<td dir="ltr">LES PIERRELLES</td>
<td dir="ltr">12KX+221+1932</td>
<td dir="ltr">BONDOUFLE</td>
<td dir="ltr">
<td dir="ltr" >STIME</td>
<td dir="ltr" >STIME - HQ</td>
<td dir="ltr" >2 ALLÉE DES MOUSQUETAIRES</td>
<td dir="ltr" >12KX-I7LT87</td>
<tr><td dir="ltr"
rowspan="2">BOULOGNE BILLANCOURT</td><td dir="ltr">
<td dir="ltr" >RENAULT</td>
<td dir="ltr" >RENAULT - HQ</td>
<td dir="ltr">13 QU ALPHONSE LE GALLO
<td dir="ltr" >12KX+22H+2985</td>
<td dir="ltr">
<td dir="ltr">THOMSON</td>
<td dir="ltr">THOMSON - HQ</td>
<td dir="ltr">46 QUAI ALPHONSE LE GALLO</td>
<td dir="ltr">12KX+2N4+2188</td>
<td dir="ltr" >CLERMONT FERRAND</td>
<td dir="ltr" >
<td dir="ltr" >MANUF FRANC
<td dir="ltr" >MICHELIN - HQ</td>
<td dir="ltr" >LA COMBAUDE</td>
<td dir="ltr" >12KX+22H+4637</td>
<td dir="ltr" rowspan="1">CLICHY</td>
<td dir="ltr" value="12KY-N2U76X">
<td dir="ltr" >CRMP8003TEST2-Looser</td>
<td dir="ltr" >8003TEST2-HQ</td>
<td dir="ltr" >5 BD RAPP</td>
<td dir="ltr" >12KY-N2U76X</td>
<tr><td></td><td></td><td></td><td></td><td><input type="button" value="setXX" onclick="testColum()"></td></tr>