Hello everyone.
So far I am getting some progress in my javascript code now. I am just going to post the function changed for not to increase this thread ok.
Code:
function testColum(){
var colsToAddScope = 2;
var myBoolean=new Boolean(false)
var 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++) {
novaRow = allTdElements[k].getAttribute("rowSpan");
novaCol = allTdElements[k].getAttribute("colSpan");
if (k<colsToAddScope){
if(novaRow > 1){
alert("novaRow " + novaRow);
myBoolean = true;
}
if(novaRow < 2){
alert("myBoolean == false");
myBoolean = false;
}
f(myBoolean == true){
allTdElements[k].innerHTML = "contain rowspan";
}
if(myBoolean == false){
allTdElements[0].innerHTML = "s";
//allTdElements[1].innerHTML = "f";
}
}
// Set the scope tag for the appropriate columns
if (k<colsToAddScope){
allTdElements[k].setAttribute("scope","row");
}
}
}
}
}
}
When the number of rowspan is less than 2 and setting the boolean to false, I can print the string "s" under the Country and city columns only with no problem because iam getting the cell index[0].
Code:
if(myBoolean == false){
allTdElements[0].innerHTML = "s";
//allTdElements[1].innerHTML = "f";
}
but if I take the commented code out prints the string "f" on the cells where the value of the cell index is 1 under not only the city column but also in others too because it span other rows which contain the rowspan atribute. But I dont to print the string "f" under other colunms but the Country an city ones which is the first 2 columns in the table. I am finding really hard to do! Does anyone knows how to or came across something similar in the past?
I really need a hand on this one please
Bookmarks