retrieving <TD> values that have no <INPUT>

liunx

Guest
I have a table with <TD> tags, but not necessarily an <input> tag between the <TD> and </TD> tags .<br />
Using JavaScript, is there any way I can I retrieve the value in the TD tag? (Of course, I can create an <input> with an invisible border, and get this value easily, but then I am unnecessarily creating another field. I have to do this at several places and then post the form, so I am not too keen on creating so many fields.)<br />
<br />
Example:<br />
<br />
<FORM name=myForm><TABLE><br />
<TR><TD>Name</TD><TD id=Row1Col2>John</TD></TR><br />
<TR><TD>Age</TD><TD><INPUT id=ageTx></TD></TR><br />
</TABLE></FORM><br />
<br />
Now, in JavaScript, I can get the age by saying :<br />
<br />
document.myForm.ageTx.value;<br />
<br />
but I cannot get "John" by saying:<br />
<br />
document.myForm.Row1Col2.value OR document.myForm.Row1Col2.text<br />
<br />
Any suggestions?<br />
<br />
Thanks,<br />
Nandita<!--content-->document.getElementById('Row1Col2').innerHTML<!--content-->Thanks, JHL; this works.<!--content-->
 
Back
Top