quote:
Originally posted by Adeptus
I think that you may be looking at this the wrong way. Instead of parsing your site to extract the text from a specific <div> it may be much simpler to have your site provide the same text in a more handy format, such as a .txt file or a web service. If it is "your" site, you should have the ability to set this up.
If it isn't your site, the functionality you are talking about is called "web scraping" and looking that up may yield some helpful information.
quote:
Originally posted by Spunky
A simple and crude method would just to be:
Javascript code:
// txt is the xmlhttp responseText stored in a variable
txt = txt.split('<div id="1">')[1];
txt = txt.split('</div>')[0];
// txt will now be the div contents including the html
// if the content is bold for example, you will see:
// This is the <b>content</b> from the div
EDIT:
It may be possible to do this in one line:
Javascript code:
txt = txt.split('<div id="1">')[1].split('</div>')[0];
I can't be sure of that one though without trying it, but most javascript seems to chain quite well
Thanks to both of you! I've got it figured out now