I am creating cells in a table using the following code -
in a for loop {
var sCell = document.all("Matrix").rows[countRow].insertCell();
//The id of the cell is "Cell" + row + column
sCell.id = "cell" + countRow + countCol;
//The value of the cell is the id again sCell.innerHTML = sCell.id;
}
All of the above is after the load of the document. I want to add some events for each of those cells.
when I explicitly mention -
<SCRIPT FOR=cell00 EVENT='onclick' LANGUAGE="JavaScript">
editCell(this);
</SCRIPT>
The method "editCell(this)" evokes fine for the cell with an id cell00. (row=0 column=0)
But I want to add the script as the cells are being created. As I would not know as to how many cells I may require.
Can anyone please suggest the way to do it.
in a for loop {
var sCell = document.all("Matrix").rows[countRow].insertCell();
//The id of the cell is "Cell" + row + column
sCell.id = "cell" + countRow + countCol;
//The value of the cell is the id again sCell.innerHTML = sCell.id;
}
All of the above is after the load of the document. I want to add some events for each of those cells.
when I explicitly mention -
<SCRIPT FOR=cell00 EVENT='onclick' LANGUAGE="JavaScript">
editCell(this);
</SCRIPT>
The method "editCell(this)" evokes fine for the cell with an id cell00. (row=0 column=0)
But I want to add the script as the cells are being created. As I would not know as to how many cells I may require.
Can anyone please suggest the way to do it.