How to read/modify a cell of a HTML table with a JavaScript

S

Stefan Mueller

I'd like to read and modify a cell (e.g. 'Text 1') in the following HTML
table with a JavaScript:

==============================================

<html>
<body>
<table id = "MyTable">
<tr id = "Row1">
<td width = "40%">
Text 1
</td>
<td width = "60%">
Text 2
</td>
</tr>
</table>
</body>
</html>

==============================================

With
var table = document.getElementById("MyTable");
I can access the table and with
... table.rows[var_tabelle.rows.length - 1].firstChild
I can somehow access the row. But I can't read and also not change the
content.

Stefan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,525
Members
44,997
Latest member
mileyka

Latest Threads

Top