Getting row/column index of HTML TABLE cell 
Author Message
 Getting row/column index of HTML TABLE cell

Hello,

Here is a little function I wrote to capture just what you are looking for.
I used it to create an updateable table. You may have to tweek it a little
for you purposes. Sorry about the formatting on paste from notepad. :(

Ted White
Intelesoft

function TblRecordsOnClick()
{
 var tempText;
 var cellWidth;

 if (event.srcElement.tagName == "TD")
 {
  if (curRow != 0)
  {
   tempText = EditBox.value;
   tblRecords.rows(curRow).cells(curCol).innerHTML = "";
   tblRecords.rows(curRow).cells(curCol).innerText = tempText;
  }
  curRow = event.srcElement.parentElement.rowIndex;
  curCol = event.srcElement.cellIndex;
  tempText = tblRecords.rows(curRow).cells(curCol).innerText;
  cellWidth = tblHeader.rows(0).cells(curCol).style.width;
  tblRecords.rows(curRow).cells(curCol).innerText = "";
  tblRecords.rows(curRow).cells(curCol).insertAdjacentHTML("BeforeEnd",
"<INPUT ID='EditBox' TYPE='Text' VALUE='" + tempText + "' STYLE='width:" +
cellWidth + ";'>");
 }

Quote:
}

>Is it possible, in connection with the ondblclick event in a table cell, to
>retrive the row and column number of the cell clicked?

>I am working with IE 4.0; it would be OK to use IE-specific additions, as I
>am building an in-house report tool that will only be viewed by IE clients.

>I am new to VBScript/the IE document object model. I have looked through
the
>documentation available to me, but can't find any answer there.

>Hans Olav Husum



Tue, 28 Aug 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Get Cell Row and Column index

2. Column/Cell Widths In HTML Tables

3. Accesing cells in related rows in HTML table????

4. Menu will only work in the first cell of a table column

5. moving cells within a table/column

6. ADD ROWS AND CELLS TO TABLES

7. table columns and rows

8. Max Row and Column + if cell empty, don't compute

9. Moving active cell to a certain column in the same row

10. Getting the cell index reference

11. Getting cell info from row selected in DBGrid...

12. getting column datatypes of mssql database table

 

 
Powered by phpBB® Forum Software