N
norfleet
hi folks,
OK, so let's say, for example, I have a bit of HTML that looks like
this:
<td class="regular1b" valign="top">
<a href="notfound.html"><span class="list5"><b>Lecture
V</b></span></a>
</td>
And I want to save all the text ("all" meaning the tags and
everything) between the <td> and </td>. Using JavaScript, I was able
to isolate the <td></td> by doing:
var w = myTable.getElementsByTagName("TD");
So then I have an IF statement within a FOR loop that looks like:
if (w.item(i).className == "regular1b")
alert(w.childNodes[0].nodeValue);
The ALERT() is just a place holder to make sure things are working.
The thing is, nodeValue returns NULL because there's no actual text
within the <td></td> tags; the only thing there is more HTML code, and
the text between the <span></span> apparently isn't considered part of
the <td></td> tags.
I guess I'm wondering if there's another way to go about getting the
text from in between the <td></td> tags short of just doing a
brute-force text search on the whole darn page. Any help would be
much appreciated...
Fleet
OK, so let's say, for example, I have a bit of HTML that looks like
this:
<td class="regular1b" valign="top">
<a href="notfound.html"><span class="list5"><b>Lecture
V</b></span></a>
</td>
And I want to save all the text ("all" meaning the tags and
everything) between the <td> and </td>. Using JavaScript, I was able
to isolate the <td></td> by doing:
var w = myTable.getElementsByTagName("TD");
So then I have an IF statement within a FOR loop that looks like:
if (w.item(i).className == "regular1b")
alert(w.childNodes[0].nodeValue);
The ALERT() is just a place holder to make sure things are working.
The thing is, nodeValue returns NULL because there's no actual text
within the <td></td> tags; the only thing there is more HTML code, and
the text between the <span></span> apparently isn't considered part of
the <td></td> tags.
I guess I'm wondering if there's another way to go about getting the
text from in between the <td></td> tags short of just doing a
brute-force text search on the whole darn page. Any help would be
much appreciated...
Fleet