Below is the working code, first cross the table to get the values โโin this, then compare with your required value and find its index ..,
<html> <head> <script> function cellvalues() { var table = document.getElementById('mytable'); for (var r = 0, n = table.rows.length; r < n; r++) { for (var c = 0, m = table.rows[r].cells.length; c < m; c++) { var hi=table.rows[r].cells[c].innerHTML; if(hi==03) { alert(table.rows[r].cells[c].cellIndex); } } } } </script> </head> <body> <table id="mytable"> <tr><td>01</td><td>02</td><td>03</td> </tr> <tr><td>04</td><td>05</td><td>06</td> </tr> <tr><td>07</td><td>08</td><td>09</td> </tr> </table> <input type="button" onclick=cellvalues()> </body> </html>
source share