[thelist] dHtml <td> contents

Tab Alleman talleman at autobex.com
Wed Nov 15 15:16:59 CST 2000


Ok, I'm going in that direction, and it looks pretty good for a while, but
now I've run into this:  I need to send the id of <td> to the javascript
function (cuz I lied:  I don't really just have 2 <td>'s.)

So I've got something like this in my select's onchange:
onchange=UpdateTD(this,'TV1')

and my function looks like this (at the moment):

	function UpdateTD(eType,eCt)
		{
		alert(eType.selectedIndex + ', ' + eCt);
		if (eType.selectedIndex == 0)
			{
			document.all.eCt.innerHTML = '<%= tdText %>';
			}
		}

What happens when I select the first element and trigger the onchange, the
alert works as expected: "0, TV1"
But next I get an error that "document.all.eCt is not an Object"..

erm.. how do I get it to interpret eCt as the value I passed it, and not
literally "eCt"?

I love JavaScript.  :)

-----Original Message-----
Probably the technique you want to look at is assigning the desitination
cell (the cell into which you wish to load the content) an id, then set the
innerHTML of that cell through the DOM.

For example:

<table>
  <tr>
    <td id=foo>bar</td>
  </tr>
</table>

Then, somewhere in javascript, execute:

  document.all.foo.innerHTML = 'bar2';





More information about the thelist mailing list