Hi,
I'm trying to set table cells according to co-ordinates [x][y] - does anyone know if this is possible?
Here's what I've done so far:
<html>
<head>
<title>
Trial & Error - Table Cells
</title>
</head>
<body>
<script type="text/javascript">
function getRow(t) {
var col=t.cellIndex; //Gets column number clicked on.
var row=t.parentNode.rowIndex; //Gets row number clicked on.
var tableRow = document.getElementById("myRow"); //Gets row clicked on by Id.
var tableCells = tableRow.getElementsByTagName("td"); //Gets cell inside row that was clicked on.
document.testForm.inputA.value = (tableCells[0].innerText); //Sets the value of the input area.
//Ideally I'd like something like this: document.testForm.inputA.value = (tableNAME[row][col].innerText);
}
</script>
<form name="testForm" action='test.html'>
<table border='1' style="background-color:black; color:white">
<tr id="myRow">
<td width='150px' onclick="getRow(this)">
<b>Test A</b>
</td>
</tr>
<tr>
<td>
<input type='text' name='inputA' value=''/>
</td>
</tr>
</table>
</form>
</body>
</html>
Ideally I'd like something like this: document.testForm.inputA.value = (tableNAME[row][col].innerText);
Thanks,
-Ash.