Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VBScript HTML
Hi,
 
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
Anhsa111
Rate this: bad
good
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.
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

try following sample...
 

<?xml version="1.0" encoding="UTF-8"?>
 
<html>
  <head>
  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
  </head>
<body>
 
  <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);
    });
 
});
</script>
 
<table>
<tr><td>a1</td><td >a2</td></tr>
<tr><td >b1</td> <td>b2</td></tr>
</table>
  </body>
</html>
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 290
1 Jochen Arndt 150
2 Kornfeld Eliyahu Peter 149
3 PIEBALDconsult 110
4 Richard MacCutchan 105
0 OriginalGriff 6,080
1 DamithSL 4,648
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,624
4 Sergey Alexandrovich Kryukov 3,294


Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 3 Jan 2012
Copyright © CodeProject, 1999-2014
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