Forum Moderators: open
i.e.:
<tr id="t1"></tr>
<a href... onclick="updateRow();"...
<script language="javascript">
<!--
function updateRow() {
document.getElementById("t1").innerHTML="<td>stuff</td>";
}
-->
</script>
Now, I've definitely narrowed it down to the assignment of innerHTML. I've even checked to see that I can read from innerHTML, and that works fine. Any suggestions?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- doctype on one line -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Untitled</title>
<script type="text/javascript">
function updateRow() {
document.getElementById("t1").innerHTML="stuff";
return false;
}
</script>
</head>
<body>
<table>
<tr><td><a href="#" onclick="return updateRow();">Test</a></td></tr>
<tr><td id="t1"></td></tr>
</table>
</body>
</html>
Which works, but reveals IE has a problems with creating a TD using innerHTML. You want to create columns. So I think you're going to need to explore document.createElement. Something like this should get you started:
row = document.getElementById('t1');
cell = document.createElement('td');
row.appendChild(cell);
cell.innerHTML = 'stuff in row 1 cell 1';