Trying to understand how to obtain the text of a td tag element within a table and especially how to change that text using xml DOM and javascript. here's what I have so far; any help appreciated...
Code:<!DOCTYPE html PUBLIC "" <html xmlns=""> <head> </head> <body> <table border="1"> <tr> <td>some text here</td> </tr> </table> </body> <script type="text/javascript"> <!-- Try several ways to write out text of the td tag ??? --> document.write(document.getElementsByTagName("td").item[0]); document.write(document.getElementsByTagName("td").item[0].childnodes[0].nodeValue); var TDElement0 = document.getElementsByTagName("td").item[0]; document.write(TDElement0); <!-- Try to change the text of the td tag ??? --> document.getElementsByTagName("td").item[0].childnodes[0].nodeValue = "different text here"; </script> </html>


Reply With Quote
Bookmarks