Referencing Table Data Cells with DOM/DHTML

  • Thread starter Thread starter get_dave
  • Start date Start date
G

get_dave

Hi. I'm new to DHTML. What i am trying to do is access the innerHTML of
a particular cell in my table. However i can't make it work.

I have tried giving the cell an id (in the exmaple below it's "floor".
I then tried to reference it using the following javascript:

document.getElementById('floor').innerHTML="New header"

however i doesn't work.

how do i do this?

any ideas please send to (e-mail address removed)
 
You need to create a variable and set the variable = to:"
document.getElementById('floor').innerHTML

Var floorinner
floorinner = document.getElementById('floor').innerHTML

--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
........................with a computer
 
This seems to work just fine. What does "doesn't work" mean.

<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<script language="JavaScript">
<!--
function changeHeader() {
document.getElementById('floor').innerHTML="New Header";
}
//-->
</script>
<title></title>
</head>

<body>
<table>
<tr>
<td id="floor">Some Header</td>
</tr>
<tr>
<td>blah blah</td>
</tr>
</table>
<script language="JavaScript">
<!--
changeHeader();
//-->
</script>
</body>
</html>


Bob Lehmann
 
Back
Top