hi guys, this is my first javascript program so i'm certainly a noob.
i just want to ask why doesn't this global variable not recognized by my functions .. ?
the thing is i need to get the id of a certain table to count the number of rows and columns in it so that i could sum up their values
this is the code that i've used in getting the table id:
var Tableid;
function getTableID(tableID){
while (tableID.nodeName.toLowerCase() != 'table')
tableID = tableID.parentNode;
alert(tableID.id);//for checking only
var Tableid = tableID.id;
}
function getColumnCount()
{
return document.getElementById(Tableid).getElementsByTagName('tr')[0].getElementsByTagName('td').length;
}
function getRowCount()
{
return document.getElementById(Tableid).rows.length;
}
to trigger the getTableID i place the onclick="getTableID(this)" on the input tag of html.
i'm pretty sure that the code for the summation is working because i've tried specifying the table name.
thx in advance.