get textbox from a html table cell
Hello, I have a problem to access the input( a simple TextBox ) from html table cell. Here is a little example of structure from my Table:
<table> <tbody> <tr id="row_1"> <td ="description" >Here is the input number 1</td> <td> </tr> <tr id="row_1"> <td ="description" >Here is the input number 1</td> <td> <td id="input_cell_1"> <input id="input_1" type="text" > </td> </tr> <tr id="row_2"> <td ="description" >Here is the input number 2</td> <td> <td id="input_cell_2"> <input id="input_2" type="text" > </td> </tr> ........... <tr id="row_n"> <td ="description" >Here is the input number n</td> <td> <td id="input_cell_n"> <input id="input_n" type="text" > </td> </tr> </tbody> </table>
I have tried the Find and FindChild methods, but I get this error message: "This Object do not support this property or methode.".
Here is the funktion that I wrote:
function GetACellTextBox(myTable, cellIdStr) { if(myTable!=null) { if(aqString.Compare(cellIdStr, "", false)!=0) { var tBody, tRow, tCell, tInput; for(var t=0; t<myTable.tBodies.length; t++) { tBody=myTable.tBodies.item(t); for(var i=0; i<tBody.rows.length; i++) { tRow=tBody.rows.item(i); for(var j=0; j<tRow.cells.length; j++) { tCell=tRow.item(i).cells.item(j); tInput=tCell.Find("tagName", "input", 5); if(tInput!=null) { // compare the idString with cellIdStr
// if equals then return tInput;
// this is not the problem } } } } } else Print("GetACell: cellIdStr is NULL.") } else Print("ClickOnACell: Object "+myTable+" is leer."); return null; }
I can not use Find Methods for tRow and tCell, because I get the same error message again and again.
What I search for is something like this tCell.GetContent() or tCell.firstChild. And yes, I can use the Find Methode like this myTable.FindAllChildren("tagName", "input", 50), but this is not ok for me.
Is it possible to get the content from a html table cell?
I really appreciate any help you can provide.
Ok, I found the solution, I have to use Cell(x,y) Methode (Example: myTable.Cell(x,y)) for this.
Sorry, my mistake.