Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: VBScript HTML
I have an html table with 10 columns as fields(TC1,TC2.....TC10) and 10 rows (R1, R2,........R10). This able contains only pass and fail data as per the combination of TC1 vs R1, TC1 vs R2 and so on.
When a user clicks on any of the cell with value as Fail.
I need to retrieve the value of the </brow and column number of that cell. This click could be on any call with value as Fail.  
I need the row and column values to do further calculations
Posted 3-Jan-12 1:56am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

check these links..
tables cell from javascript[^]
how do you access rows columns html table[^]
access Table cells content Firefox[^]
write the javascript function discussed in above links and call that function from OnClick event of Table cell.
<table><tr><td id="tdid"  önclick="funcName()"></td></tr></table>
hope it helps.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

try following sample...

<?xml version="1.0" encoding="UTF-8"?>
  <script type="text/javascript" src=""></script>
  <script type="text/javascript">
$(document).ready(function() {
    $('td').click(function() {
        var col = $(this).parent().children().index($(this));
        var row = $(this).parent().parent().children().index($(this).parent());
        alert('Row: ' + row + ', Column: ' + col);
<tr><td>a1</td><td >a2</td></tr>
<tr><td >b1</td> <td>b2</td></tr>

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 345
1 DamithSL 140
2 Zoltán Zörgő 120
3 Afzaal Ahmad Zeeshan 105
4 Sergey Alexandrovich Kryukov 99
0 enhzflep 40
1 Richard Deeming 25
2 OriginalGriff 10
3 Anddos 10
4 Kornfeld Eliyahu Peter 10

Advertise | Privacy | Mobile
Web04 | 2.8.150224.1 | Last Updated 3 Jan 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100